jquery - How To Make Animate When Closed?[Javascript] -


javascript here

<script>     function toggle2(showhidediv, switchtextdiv) {         var ele = document.getelementbyid(showhidediv);         var text = document.getelementbyid(switchtextdiv);         $(ele).slidetoggle();         if(ele.style.display == "block") {             ele.style.display = 'none';         } else {             ele.style.display = 'block';         }     } </script> 

and html

<a id="myheader" href="javascript:toggle2('mycontent','myheader');" >     <img   src="gcont/images/cloud/folder.png" alt="" height="30" width="30"/>     general </a> </div> <div style="clear:both;"></div> <div id="contentdiv">     <div id="mycontent" style="display: none;">         <a href="http://1drv.ms/1zn0hud" target="_blank">____test sub article</a></br>         <a href="http://1drv.ms/1picktz" target="_blank">____green line stock</a>     </div> </div> 

any chance make close smooth?cuz close still bug not animate. thank you

there no need set display style, slidetoggle() handle it

function toggle2(showhidediv, switchtextdiv) {    $('#' + showhidediv).slidetoggle();  }
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>  <div>    <a id="myheader" href="javascript:toggle2('mycontent','myheader');">      <img src="gcont/images/cloud/folder.png" alt="" height="30" width="30" />general</a>  </div>  <div style="clear:both;"></div>  <div id="contentdiv">    <div id="mycontent" style="display: none;">      <a href="http://1drv.ms/1zn0hud" target="_blank">____test sub article</a>      <br/>      <a href="http://1drv.ms/1picktz" target="_blank">____green line stock</a>    </div>  </div>


Comments

Popular posts from this blog

sql - VB.NET Operand type clash: date is incompatible with int error -

SVG stroke-linecap doesn't work for circles in Firefox? -

python - TypeError: Scalar value for argument 'color' is not numeric in openCV -