jQuery: execute something after an effect is finished -
i have top nav bar, when click on item megamenu slides down, if click on again, megamenu slides up.
sometimes, have elements (links , paragraphs) z-index higher mengamenus, when megamenus slide down, appear on top of megamenu. solved issue code below.
however, solving issue, 1 came , need help:
when megamenus sliding up, z-index of elements changed 1, elements appear on top of megamenu while megamenu sliding up.
is there way have action of changing z-index of elements after megamenus have finished sliding up?
here's code far:
$('.click-menu h6 span').click(function() { if ($(this).hasclass('selected')) { $(this).removeclass('selected'); $(this).parent().next().slideup('fast'); $('.generic-box a, .generic-box p').css('z-index', '1'); } else { $('.click-menu h6 span').removeclass('selected'); $(this).addclass('selected'); $('.click-menu div').slideup('fast'); $(this).parent().next().slidedown('fast'); $('.radio-btns-wrapper-wjs').slideup('fast'); $('.generic-box a, .generic-box p').css('z-index', '0'); } }); any appreciated.
both slideup , slidedown accept optional callback parameters execute once animations finished:
$('.click-menu h6 span').click(function(){ if ($(this).hasclass('selected')) { $(this).removeclass('selected'); $(this).parent().next().slideup('fast', function() { $('.generic-box a, .generic-box p').css('z-index','1'); }); } else { $('.click-menu h6 span').removeclass('selected'); $(this).addclass('selected'); $('.click-menu div').slideup('fast'); $(this).parent().next().slidedown('fast'); $('.radio-btns-wrapper-wjs').slideup('fast', function() { $('.generic-box a, .generic-box p').css('z-index','0'); }); } });
Comments
Post a Comment