Html
    Css
    Js

    
                        
#test1 {
	width:600px;
	border:1px dashed red;
	overflow:hidden;
}

                        
↑上面代码改变,会自动显示代码结果 jQuery调用版本:1.11.3
 立即下载

js图片循环滚动

平滑过渡,图片循环轮播

1
      罄?一瞥3
      2017/7/5 9:21:44

      代码很混乱,完全可以缩减一半

      <body>
          <div id="test1">
              <table>
                  <tr>
                      <td id="m1">
                          <table>
                              <tr>
                                  <td><img src="http://www.jq22.com/img/6.png" /></td>
                              </tr>
                          </table>
                      </td>
                      <td id="m2"></td>
                  </tr>
              </table>
          </div>
          <script>
              window.onload = function() {
                  m2.innerHTML = m1.innerHTML;
                  var t = setInterval(run, 10);
              };
      
              function run() {
                  (++test1.scrollLeft >= m1.clientWidth) && (test1.scrollLeft = 0)
              }
          </script>
      </body>
      回复