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

Add option to bind to more events other than window.load #150

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 10 additions & 3 deletions js/source/jquery.smoothDivScroll-1.3.js
Original file line number Diff line number Diff line change
Expand Up @@ -398,8 +398,17 @@
// setting of the hotspot backgrounds is started here as well for the same reason.
// If the auto scrolling is not started in $(window).load, it won't start because it
// will interpret the scrollable areas as too short.
$(window).load(function () {
$(window).load($.proxy(self._widthKnown, self));
if(o.additionalLoadEvents) {
//format: [{selector, event}]
$.each(o.additionalLoadEvents, function(i, n) {
$(n.selector).on(n.event, $.proxy(self._widthKnown, self));
});
}

},
_widthKnown: function() {
var o = this.options, self = this, el = this.element;
// If scroller is not hidden, recalculate the scrollable area
if (!(o.hiddenOnStart)) {
self.recalculateScrollableArea();
Expand Down Expand Up @@ -446,8 +455,6 @@

self._trigger("setupComplete");

});

},
/**********************************************************
_init
Expand Down