JQuery toggle on li causing other li to bounce -
hi making information dropdown uses jquery toggle. when click on 1 open toggle div beneath it causes other li bounce down pop place. want them remain stationary.
i added absolute position removes flow , not push lower divs down when toggle div opens. toggle div covers other divs below it.
here jquery:
var open = $('.open'), = $('ul').find('a'); console.log(a.hasclass('active')); open.click(function(e){ e.preventdefault(); var $this = $(this), speed = 500; if($this.hasclass('active') === true) { $this.removeclass('active').next('.box').slideup(speed); } else if(a.hasclass('active') == false) { $this.addclass('active').next('.box').slidedown(speed); } else { a.removeclass('active').next('.box').slideup(speed); $this.addclass('active').next('.box').delay(speed).slidedown(speed); } }); })(jquery);
and here html:
<div class="grid_12 omega boxes"> <ul> <li id="monday"><a href="javascript:void(0)" class="open"><img src="wp-content/themes/english42/img/mon.svg"></a><div class="box" >this toggle div1</div></li> <li id="tuesday"><a href="javascript:void(0)" class="open"><img src="wp-content/themes/english42/img/mon.svg"></a><div class="box">this toggle div2</div></li> <li id="wednesday"><a href="javascript:void(0)" class="open"><img src="wp-content/themes/english42/img/mon.svg"></a><div class="box">this toggle div3</div></li> <li id="thursday"><a href="javascript:void(0)" class="open"><img src="wp-content/themes/english42/img/mon.svg"></a><div class="box">this toggle div4</div></li> <li id="friday"><a href="javascript:void(0)" class="open"><img src="wp-content/themes/english42/img/mon.svg"></a><div class="box">this toggle div5</div></li> <li id="saturday"><a href="javascript:void(0)" class="open"><img src="wp-content/themes/english42/img/mon.svg"></a><div class="box">this toggle div6</div></li> </ul> </div>
any great. thanks.
Comments
Post a Comment