Reputation: 1295
I have two javascript functions.
First one is:
function gallery(page)
{
$.scrollTo( '#'+page, 1000, '#' );
}
The next one is like this:
window.onscroll = function ()
{
makeCallv();
}
Here i want to disable window.onscroll function when gallery function is called. And scroll function should be active when function gallery is not called.
Can anyone help me as i am getting this problem for two days. Thanks in advance
Upvotes: 0
Views: 4438
Reputation: 827466
Seems that you are using the scrollTo jQuery plugin, with this plugin you can bind an event that executes when the scrolling animation has ended (onAfter
).
You could unbind the window.onscroll event before calling the plugin, and re-bind it when the scrolling animation ends:
function gallery(page) {
window.scroll = null; // unbind the event before scrolling
$.scrollTo( '#'+page, 1000, '#', {onAfter: function () {
window.onscroll = makeCallv; // bind the event when the animation ends
}
});
}
window.onscroll = makeCallv;
Upvotes: 3