GitHub is home to over 20 million developers working together to host and review code, manage projects, and build software together.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
Already on GitHub? Sign in to your account
When the container is "window" and event is "scroll", will cause window to scroll back to top on IE 7.
The reason is
// settings.container = window
// settings.event = "scroll"
works as the below code on IE 7:
Also, I cached window object to improve performance.
1) Fix always scroll to top issue on IE7. 2) Cache window object to
Support custom source property and able to fallback while using older…
Fix IE 7 scroll to top issue when window be resized. Change custom
attribute name to "data-attr".
I cannot merge this patch cleanly anymore since there have been quite many changes. But I am doing it manually. Great patch! Short scoping and caching the window object almost doubles the selector speed.
Do you still experience the IE7 bug also with latest jQuery? To me it looks like it was fixed in 1.7.
Maybe latest jQuery fixed this issue, but for some frameworks, e.g. Drupal 6, you can't simply update jQuery to latest one, that's why I fix this issue, and this issue is easy to fix :-)
About the performance of copying window, on my Chrome 16.0.912.75 on Mac OS X 10.7.2, it's faster than don't copy.
In fact, I was just wanna pull request for the IE 7 issue, not the performance or something else :/
Coz I'm customizing it to fit our Drupal project.
Just Forget about it.
That is interesting. I just tested Chrome 16.0.912.75 on Mac OS X 10.7.2 and I get around 4600 ops / second when copying and 7200 ops / second when caching.
Anyway, what version of jQuery Drupal 6 is using?
Drupal 6 is using 1.2.6 for core library (WTF?!), with a third-part module, can be upgraded to 1.3.2.
In the past, I tried to upgrade to 1.5.2 (or lower), and lots of core features were broken.
Although I can load latest jQuery with $.noConflict() and initialize lazyload with it.
The issue affects even jQuery 1.7 as far as I can tell. Try scrolling to the bottom of http://www.ea.com/ and executing jQuery(window).trigger('scroll'), which is what happens in this plugin's resize listener by default. That call scrolls the page to the top.
Example: scroll to the bottom of your project page, http://www.appelsiini.net/projects/lazyload, and then resize the window. It scrolls to the top.
Edit: I'm on OS X, Chrome 17.0.963.56
Actually project page has 1.6. Demo pages have 1.7.
But since many people are still using 1.6 and older I might consider including Chris' workaround for Chrome.
I noticed the 1.6/1.7 difference right after I wrote my comments. The workaround doesn't seem ideal, calling $window.scrollTo with the current coordinates.