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

android - Why am I getting the message 'Youractivity.java is not an activity subclass or alias' -

python - How do I create a list index that loops through integers in another list -

c# - “System.Security.Cryptography.CryptographicException: Keyset does not exist” when reading private key from remote machine -