javascript - Toggle CSS on mouseup -
i have console setup on tool i've created. console can minimized when clicked , maximized when clicked again.
the issue 1 time maximize it, minimizes when complete. options?
$('#consolebutton').mouseup(function() { if ($('#footconsole').height(200)) { $('#footconsole').animate({ height: 14 }, 100) } else if ($('#footconsole').height(14)) { $('#footconsole').animate({ height: 200 }, 100); } });
(i realize checking height of div, setting height of div , problem.)
http://jsfiddle.net/vadbw/3/
try this...
$('#consolebutton').mouseup(function() { var $footconsole = $('#footconsole'); if ($footconsole.height() == 200) { $footconsole.animate({ height: 14 }, 100) } else { $footconsole.animate({ height: 200 }, 100); } });
it comparing against height (rather set it), , set variable value of $("#footconsole")
, rather maintain searching it.
javascript jquery html css
No comments:
Post a Comment