首页 DIV+CSS 正文
  • 本文约224字,阅读需1分钟
  • 2689
  • 0
举报该广告
无缝隙滚动代

无缝隙滚动代

摘要
横向

<div id="hot" style="overflow: hidden; width: 100%; color: #ffffff">

                  <table cellSpacing="0" cellPadding="0" align="left" border="0">

            ...
横向

<div id="hot" style="overflow: hidden; width: 100%; color: #ffffff">

                  <table cellSpacing="0" cellPadding="0" align="left" border="0">

                    <tbody>

                    <tr>

                      <td id="divhot" valign="top">

                    内容                      </td>

                      <td id="hot2" valign="top">&nbsp;</td></tr></tbody></table></div>         

                    <script type="text/javascript">

                    var hot = document.getElementById("hot");

                     var hot1 = document.getElementById("divhot");

                     var hot2 = document.getElementById("hot2");

                     var pause=0;         

                     hot2.innerHTML=hot1.innerHTML;

                     function scrollMl()

                     {

                        if(hot2.offsetWidth-hot.scrollLeft<=0)

                        {

                            hot.scrollLeft-=hot1.offsetWidth;

                        }

                        else

                        {

                            hot.scrollLeft++;

                        }

                     }

                     function scrollMr()

                     {

                        if(hot.scrollLeft<=0)

                        {

                            hot.scrollLeft+=hot2.offsetWidth;

                        }

                        else

                        {

                            hot.scrollLeft--;

                        }

                     }                      

                    var hottime;

                    function doLeft()

                    {

                        clearInterval(hottime);

                         hottime=setInterval(scrollMl,20);

                    }

                    function doRight()

                    {

                        clearInterval(hottime);

                        hottime=setInterval(scrollMr,20);

                    }

                    hot.onmouseover=function(){clearInterval(hottime);}

                    hot.onmouseout=function(){hottime=setInterval(scrollMl,20);}

                    doRight();     

                    </script>

📱 扫码关注公众号

公众号二维码

扫描二维码关注我们,获取更多精彩内容
实时更新 · 干货满满

收藏

扫描二维码,在手机上阅读
评论
更换验证码
友情链接