javascript - Why does this if/else statement always execute the if branch? -
hey guys know there exists .slidetoggle()
want add together more features later.
i don't know i'm doing wrong, sliding works cannot slide down.
can not overwrite var? nice when can help me.
$(document).ready(function () { var resizevalue = true; $(".resizeselect").click(function () { if (resizevalue === true) { $(".resize").slideup( function () { $('.parent').height($('.child').height('100')); }); var resizevalue = false; } else { $(".resize").slidedown( function () { $('.parent').height($('.child').height('100')); }); var resizevalue = true }; }); });
you shouldn't redefine resizevalue
variable within click
function. remove var
var resizevalue
(it should used @ top of ready
-function).
javascript jquery
No comments:
Post a Comment