CSS部分:

  1. #mobile4{width:auto;height:60px;overflow:hidden;cursor: pointer;font-size:12px!important;}
  2. #mobile4 a{color:#000;}
  3. #mobile4 .wtleft{ width:75px;float:left;}
  4. #mobile4 .wtname{width:100%;float:left; margin-top:8px; height:20px;}
  5. #mobile4 .order{width:100%;float:left; margin-top:3px; height:20px;}
  6. #mobile4 .wt{width:112px;float:left;margin-top:5px }
  7. #mobile4 .wtpic{line-height:48px;height:48px;width:48px;float:left;}
  8. #mobile4 .wt1{width:64px; float:left;}
  9. #mobile4 .wtline{width:100%;float:left; height:18px; line-height:18px;margin-top:3px;}
  10. .mobile04{width:100%;font-size:12px;height:24px;overflow:hidden;}
  11. .mobile04 ul{list-style-type:none;margin:0;padding:0;}
  12. .mobile04 ul li{height:25px;line-height:25px;float:left;display:inline;width:100%; overflow:hidden;}
  13. .mobile04 .f1{ background:#54A932; color:#fff; line-height:12px; padding:1px 2px 2px;}
  14. .mobile04 ul li span{padding-left:5px;}



html部分:


  1. <div class="mobile04" id="myscroll">
  2. <ul>
  3. <li>
  4. <span>2015-07-02</span>
  5. <span>温州</span>
  6. <span class="img04">
  7. <img class='pngtqico' align='absmiddle' src='http://img.tianqi.com/static/images/tianqi/b0.png' style='border:0;width:20px;height:20px'/>
  8. </span>
  9. <span style="padding-left:0px;"></span>
  10. <font style="color:#4899be;">12℃</font>
  11. <font style="color:#f00;">4℃</font>
  12. </li>
  13. <li>
  14. <span>2015-07-02</span>
  15. <span>温州</span>
  16. <span class="img04">
  17. <img class='pngtqico' align='absmiddle' src='http://img.tianqi.com/static/images/tianqi/b0.png' style='border:0;width:20px;height:20px'/>
  18. </span>
  19. <span style="padding-left:0px;" id="tenki"></span>
  20. <font style="color:#4899be;">22℃</font>
  21. <font style="color:#f00;">4℃</font>
  22. </li>
  23. <li>
  24. <span>2015-07-02</span>
  25. <span>温州</span>
  26. <span class="img04">
  27. <img class='pngtqico' align='absmiddle' src='http://img.tianqi.com/static/images/tianqi/b0.png' style='border:0;width:20px;height:20px'/>
  28. </span>
  29. <span style="padding-left:0px;" id="tenki"></span>
  30. <font style="color:#4899be;">32℃</font>
  31. <font style="color:#f00;">4℃</font>
  32. </li>
  33. <li>
  34. <span>2015-07-02</span>
  35. <span>温州</span>
  36. <span class="img04">
  37. <img class='pngtqico' align='absmiddle' src='http://img.tianqi.com/static/images/tianqi/b0.png' style='border:0;width:20px;height:20px'/>
  38. </span>
  39. <span style="padding-left:0px;" id="tenki"></span>
  40. <font style="color:#4899be;">42℃</font>
  41. <font style="color:#f00;">4℃</font>
  42. </li>
  43. <li>
  44. <span>2015-07-02</span>
  45. <span>温州</span>
  46. <span class="img04">
  47. <img class='pngtqico' align='absmiddle' src='http://img.tianqi.com/static/images/tianqi/b0.png' style='border:0;width:20px;height:20px'/>
  48. </span>
  49. <span style="padding-left:0px;" id="tenki"></span>
  50. <font style="color:#4899be;">12℃</font>
  51. <font style="color:#f00;">4℃</font>
  52. </li>
  53. </ul>
  54. </div>



js部分:


  1. <script type="text/javascript">
  2. function AutoScroll(obj){
  3. $(obj).find("ul:first").animate({
  4. marginTop:"-25px"/*根据一条的实际高度*/
  5. },500,function(){
  6. $(this).css({marginTop:"0px"}).find("li:first").appendTo(this);
  7. });
  8. }
  9. $(document).ready(function(){
  10. li_num = $('#myscroll ul li').length
  11. tenki_speed = 2000 //滚动速度
  12. if(li_num > 1){
  13. setInterval('AutoScroll("#myscroll")',tenki_speed)
  14. }
  15. });
  16. </script>
效果:



  • 2015-07-02 温州 22℃4℃
  • 2015-07-02 温州 32℃4℃
  • 2015-07-02 温州 42℃4℃
  • 2015-07-02 温州 52℃4℃
  • 2015-07-02 温州 12℃4℃