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

scrollyeah is not working for some reason until i resize the browser window? #6

Open
mailtoajay opened this issue Nov 30, 2013 · 1 comment

Comments

@mailtoajay
Copy link

scrollyeah is not working for some reason until i resize the browser window?

@gko
Copy link

gko commented Dec 8, 2013

This is due to fact that plugin thinks that your inner block is smaller than outer(on which scrollyeah is triggered).
It can be caused by following:

  1. you performed layout changes after you initialized plugin.
  2. you have some elements(like images) that were loaded after plugin was initialized.

So in second case the solution would be to make a preloader and trigger scrollyeah after all images are loaded.
As an exampled I modified the plugin:

this.each(function(){
  var scrollyeah = $(this);
  if (!scrollyeah.data('ini')) {
    var imgs = scrollyeah.find("img");
    if(imgs.length) {
      var count = 0;
      imgs.load(function() {
        if(++count===imgs.length)
          doScrollyeah(scrollyeah, o);
      });
    } else
      doScrollyeah(scrollyeah, o);
  }
});

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