Reputation: 81
Suppose below is my code. i am not responsible to make change directly to code. hence i am doing it via console. and i want to unbind this html & body animation but someotherFunction() should work as it is. there may be too many functions as well beyond my imagination like below and i want all to work as it is but only animate should be unbind.
$("#button").click(function() {
$('html, body').animate({
scrollTop: $("#myDiv").offset().top
}, 2000);
someOtherFunction();
someMoreFunctionIDontKnowAbout();
});
Upvotes: 0
Views: 107
Reputation: 18763
We will unbind the .click
event then we will add the new binding.
$('#button').unbind("click");
$('#button').click(function() {
someOtherFunction();
someMoreFunctionIDontKnowAbout();
});
I recommend if this is something you will be doing a lot and only want for yourself that you should install tampermonkey
or a similar tool to run jquery/javascript of your own on a specific domain.
Upvotes: 0