Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Image Inside a Scrollable div Would not be Loaded #83

Open
ethonchan opened this issue Apr 1, 2015 · 1 comment
Open

Image Inside a Scrollable div Would not be Loaded #83

ethonchan opened this issue Apr 1, 2015 · 1 comment

Comments

@ethonchan
Copy link

When a list of images inside a scrollable div, only images at the top would be loaded. structure like below:

<ul class='photo--list' style='height: 200px;'>
    <li class='photo' style='height: 100px;' id='a'>
        <img data-echo='some url'/>
    </li>
    <li class='photo' style='height: 100px;' id='b'>
        <img data-echo='some url'/>
    </li>
    <li class='photo' style='height: 100px;' id='c'>
        <img data-echo='some url'/>
    </li>
    <li class='photo' style='height: 100px;' id='d'>
        <img data-echo='some url'/>
    </li>
    <li class='photo' style='height: 100px;' id='e'>
        <img data-echo='some url'/>
    </li>
    <li class='photo' style='height: 100px;' id='f'>
        <img data-echo='some url'/>
    </li>
</ul>

In this circumstance, only photo a and photo b would be loaded. Photo c, d, e, f would not be loaded, for the reason that the root variable inside Echo.js is setted to be global (which is window mostly).

To solve this problem, the root variable need to be configurable. Modification is listed below:

    echo.init = function (opts) {
        opts = opts || {};
        //  modification
        root = opts.viewport || this || (0,eval)('this')
        //  original codes
    };

ethonchan
2015-04-01

ethonchan pushed a commit to ethonchan/echo that referenced this issue Apr 1, 2015
ethonchan pushed a commit to ethonchan/echo that referenced this issue Apr 1, 2015
ethonchan added a commit to ethonchan/echo that referenced this issue Apr 2, 2015
@macfredd
Copy link

macfredd commented Oct 12, 2017

I had to add the "scroll listener" to my inner container:

myDiv.addEventListener('scroll', debounceOrThrottle, false);

I have other images in the main container, and the scroll over the root works perfectly.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants