Unable to animate with insertBefore jQuery

I am using HTML5 list. I want to add new 'li' dynamically with animation.I have used an insertBefore function.Any idea how can I animate list with slide effect(Horizontal widget list).

Answers 1

  • try this

    little bit modification in @Bhargav's answer

    hope it will help :)

    $("<li style='display:none'>Test</li>").insertBefore(".inner").slideDown();
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
    <ul class="container">
      <li>Greetings</li>
      <li class="inner">Hello</li>
      <li class="inner">Goodbye</li>
    </ul>


Related Articles