Based on jQuery, It imitates the Sohu debate vote animation code, and jquery imitates Sohu animation.
Based on jQuery, it simulates the Sohu debate vote animation code. This is a personalized cartoon villain. As follows:
Download Online Preview source code
Implementation code.
Html code:
<Script type = "text/javascript"> $ (document ). ready (function () {var a = 500; var B = 130; $ ("# white "). animate ({width: 0, left: "250px"}, 1000, function () {$ ("# "). fadeIn ("slow", function () {$ ("# all" ).html (a + B); $ ("# aa" ).html (); $ ("# bb" 2.16.html (B); var newLeft = a/(a + B) * 500-20 + "px "; // 20 is half of vs $ ("# "). animate ({left: newLeft}, 1000); $ ("# red "). animate ({width: newLeft}, 1000 );});});}); </script> <div id = "box_bg"> <div id = "container"> <div id = "green" class = "line"> </div> <div id = "red" class = "line"> </div> <div id = "white" class = "line"> </div> <div id = "vs"> </div> <div style = "width: pixel PX; margin: 0px auto; "> <div id =" aa2 "class =" scope "> <span id =" aa "> </span> </div> <div id =" bb2" class = "scope"> total <span id = "bb"> </span> tickets </div> <div id = "all2" class = "scope"> <span id = "all"> </span> ticket </div>
via:http://www.w2bc.com/article/2015-12-27-jquery-vote