javascript - jQuery callback functions -
i have function - verttoggle()
- toggles element slide , downwards off screen. want create chain of events slides element off screen, changes content within it, slides up. need fired 1 after other, not @ same time need setup callbacks 1 another.
the current, non-working, setup is:
verttoggle( '-' ); $(".content").hide() $("#"+load).show(); verttoggle( '+' );
however don't have head around necessary callback function syntax create these trigger correctly, ie perform verttoggle()
, when finish hide/show
inbetween, when these done perform sec verttoggle()
.
thanks pointers.
edit: requested verttoggle function, not sure if it's relevant.. $overlay element beingness animated:
function verttoggle( offset ) { var height = $overlay.outerheight(); var props = {}; var distance = ( offset == '-' ) ? height : 0 ; props["bottom"] = offset+distance+'px'; if( !modernizr.csstransitions ) { $overlay.animate(props, 750); $overlay.toggleclass("open"); } else { $overlay.css(props); $overlay.toggleclass("open"); } }
if utilize .slidetoggle()
, can add together function callback.
$("something").click(function(){ $("somethingelse").slidetoggle(function(){ callbackfunction() }) });
does help?
javascript jquery callback
No comments:
Post a Comment