dede(织梦)无缝滚动带标题图片
发表时间:2012-02-29 19:39:03
自己贴出来,以后直接复制就好了。
HTML代码:
- <div id="demo">
- <div id="indemo">
- <div id="demo1">
- {dede:arclist row=10 titlelen=24 typeid='2'}
- <a href="[field:arcurl/]"><img src="[field:litpic/]" height="122" width="162"/><p>[field:title/]</p></a>
- {/dede:arclist}
- </div>
- <div id="demo2"></div>
- </div>
- </div>
- <script>
- <!--
- var speed=10; //数字越大速度越慢
- var tab=document.getElementById("demo");
- var tab1=document.getElementById("demo1");
- var tab2=document.getElementById("demo2");
- tab2.innerHTML=tab1.innerHTML;
- function Marquee(){
- if(tab2.offsetWidth-tab.scrollLeft<=0)
- tab.scrollLeft-=tab1.offsetWidth
- else{
- tab.scrollLeft++;
- }
- }
- var MyMar=setInterval(Marquee,speed);
- tab.onmouseover=function() {clearInterval(MyMar)};
- tab.onmouseout=function() {MyMar=setInterval(Marquee,speed)};
- -->
- </script>
CSS代码:
- #demo {
- background: #FFF;
- overflow:hidden;
- width: 97%;
- margin:20px auto 5px auto;
- }
- #demo a {float:left;}
- #demo img {
- padding:1px;
- border:1px #999999 solid;
- margin:0 10px;
- }
- #demo p {text-align:center; line-height:30px;}
- #indemo {
- float: left;
- width: 800%;
- }
- #demo1 {
- float: left;
- }
- #demo2 {
- float: left;
- }
------分割线---------------------------------------
您可能感兴趣
留个脚印
-
最新评论