Jquery Replacement for toggle -


this question has answer here:

it seems 1 of toggle functions have depreciated, wondering suitable replacement be... have searched cant seem find clear answer, can help? here code

$( ".open-btn" ).toggle(function() {     $(".foldable").css( "height", "517px" );     $(".open-btn a").text( "close menu" );     $(".reserve-btn").fadein(); }, function() {     $(".foldable").css( "height", "0px" );     $(".open-btn a").text( "show menu" );     $(".reserve-btn").fadeout(); }); 

try this:

function assigntogglehandler() {     $(".open-btn a").click(function() {         if($(".open-btn a").text() == "show menu") {             $(".foldable").css( "height", "517px" );             $(".reserve-btn").fadein();             $(".open-btn a").text( "close menu" );         } else {             $(".foldable").css( "height", "0px" );             $(".open-btn a").text( "show menu" );             $(".reserve-btn").fadeout();     } } 

then call function:

assigntogglehandler(); 

pm me if want example of 1 built in page i'm building right now.


Comments

Popular posts from this blog

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -

ruby on rails - In a controller spec, how to find a specific tag in the generated view? -