基于jQuery仿搜狐辩论投票动画代码。这是一款个性的卡通小人正方反方辩论投票特效代码。效果图如下:
实现的代码。
html代码:
<script type="text/javascript"> $(document).ready(function () { var a = 500; var b = 130; $("#white").animate({ width: 0, left: "250px" }, 1000, function () { $("#vs").fadeIn("slow", function () { $("#all").html(a + b); $("#aa").html(a); $("#bb").html(b); var newLeft = a / (a + b) * 500 - 20 + "px"; //20为vs 的一半 $("#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> </div> <div style="width:440px; margin:0px auto;"> <div id="aa2" class="scope">正方<span id="aa"></span>票</div> <div id="bb2" class="scope">反共<span id="bb"></span>票</div> <div id="all2" class="scope">总共<span id="all"></span>票</div> </div>
via:http://www.w2bc.com/article/2015-12-27-jquery-vote
时间: 2024-11-07 04:13:12