jScroll
jScroll copied to clipboard
scoll onload
return this.each(function() {
var $element = $(this);
var $window = $(window);
var locator = new location($element);
$window.scroll(function() {
$element
.stop()
.animate(locator.getMargin($window), opts.speed);
}).scroll();
});
by adding the .scroll(); after the callback is defined will enable the callback to be executed instantly. This will allow the plugin to work when someone has used the back button in a browser and it loads already scrolled down a page.
Currently this will only bring the element into view when the user scrolls. The extra .scroll() will enable it to come in on load.