How can I have these functions run one after the other, so each one finished before the next starts?
$(window).unbind();
$('.buyersseclink').removeClass('buyersseclinkon');
$(this).parent().delay(900).addClass('buyersseclinkon');
$(window).bind('scroll', function () {
$('.buyersseclink').removeClass('buyersseclinkon');
});
Thanks
delay()
does not work with methods such as addCless
. As the jQuery documentation suggests you should use setTimeout
instead:
$(window).unbind();
$('.buyersseclink').removeClass('buyersseclinkon');
var current = this; // Store reference, because in the setTimeout callback "this" maybe referring to something else
window.setTimeout(function() {
$(current ).parent().addClass('buyersseclinkon');
$(window).bind('scroll', function () {
$('.buyersseclink').removeClass('buyersseclinkon');
});
}, 900);