wduffy/jScroll — Issue #7: scoll onload
Author: KingKarl85
Created: 2011-10-18 00:04:53+00:00
State: open

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.