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

Popular posts from this blog

c++ - Difference between pre and post decrement in recursive function argument -

php - Nothing but 'run(); ' when browsing to my local project, how do I fix this? -

php - How can I echo out this array? -