javascript - Can we set a CSS animation to happen after the previous child element animated? -


imagine have ten li element under same ul element. want do, slide in effect. currently, can css animation, if want animation happen in sequence, doesn't seem have obvious way it.

i open javascript hybrid solution lone it's relatively fast (for smart phones). thanks!

i suggest recursive function. i'll use jquery this. in code animation adding margin left. can edit animation preference

    <html>     <head>     <script type="text/javascript" src="http://code.jquery.com/jquery-latest.min.js"></script>     </head>     <body>      <ul>     <li id="li-1">list item 1</li>     <li id="li-2">list item 2</li>     <li id="li-3">list item 3</li>     <li id="li-4">list item 4</li>     <li id="li-5">list item 5</li>     <li id="li-6">list item 6</li>     <li id="li-7">list item 7</li>     <li id="li-8">list item 8</li>     <li id="li-9">list item 9</li>     <li id="li-10">list item 10</li>     </ul>       <script type="text/javascript">      function slideli(curli) {     console.log(curli);      if($("#li-"+curli).length) {          $("#li-"+curli).animate({             marginleft: "+=50px"         }, 200, "linear", function() {             $(this).animate({                 marginleft: "-=50px"             }, 200, "linear", function() {                 slideli(curli-1);             });         });         return;     } else return;     }      $("ul").mouseenter(function() {     slideli($("ul li").length);     });  </script> </body> </html> 

Comments

Popular posts from this blog

how to proxy from https to http with lighttpd -

android - Automated my builds -

python - Flask migration error -