javascript - Panel won't slide out using jquery -
i'm trying gray panel slide out. entire div (with gray background) slide out when clicking "target 1", or "target 2", or "target 3" before other colored panels slide in. when click on "main menu link" entire colored panel should slide out (not blink out) before gray panel slides in. here demo http://jsfiddle.net/l7v0w96s/
<div class="main-menu"><a href="#target0" class="panel">main menu link</a> </div> <div id="right" id="main"> <div id="target0" class="panel active">this target menu<br /> <a href="#target1" class="panel">target 1</a><br/> <a href="#target2" class="panel">target 2</a><br/> <a href="#target3" class="panel">target 3</a><br/> </div> <div class="panel" id="target1" style="background:green">target 1</div> <div class="panel" id="target2" style="background:red">target 2</div> <div class="panel" id="target3" style="background:yellow">target 3</div> </div>
http://jsfiddle.net/l7v0w96s/7/
you hiding gray menu early. add callback function jquery animate, , hidden after animation finished
$other.each(function(index, self) { var $this = $(this); $this.animate({ left: $this.innerwidth() }, 500, function() { $this.removeclass('active') }); });
and change "width()"
"innerwidth()"
. calculate width including paddings.
Comments
Post a Comment