jquery - How to run these functions one after the other? -
how can have these functions run 1 after other, each 1 finished before next starts?
$(window).unbind(); $('.buyersseclink').removeclass('buyersseclinkon'); $(this).parent().delay(900).addclass('buyersseclinkon'); $(window).bind('scroll', function () { $('.buyersseclink').removeclass('buyersseclinkon'); });
thanks
delay()
not work methods such addcless
. jquery documentation suggests should use settimeout
instead:
$(window).unbind(); $('.buyersseclink').removeclass('buyersseclinkon'); var current = this; // store reference, because in settimeout callback "this" maybe referring else window.settimeout(function() { $(current ).parent().addclass('buyersseclinkon'); $(window).bind('scroll', function () { $('.buyersseclink').removeclass('buyersseclinkon'); }); }, 900);
Comments
Post a Comment