dw自动滚动图片_Dreamweaver向下滚动图片代码(不间断、带链接、鼠标指向暂停)-dreamweaver技巧-电脑技巧收藏家...

Dreamweaver向下滚动图片代码(不间断、带链接、鼠标指向暂停)

var speed=30

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

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

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

colee_bottom2.innerHTML=colee_bottom1.innerHTML

colee_bottom.scrollTop=colee_bottom.scrollHeight

function Marquee2(){

if(colee_bottom1.offsetTop-colee_bottom.scrollTop>=0)

colee_bottom.scrollTop+=colee_bottom2.offsetHeight

else{

colee_bottom.scrollTop--

}

}

var MyMar2=setInterval(Marquee2,speed)

colee_bottom.οnmοuseοver=function() {clearInterval(MyMar2)}

colee_bottom.οnmοuseοut=function() {MyMar2=setInterval(Marquee2,speed)}

来源:互联网

Dreamweaver (DW) 中创建网页表格并实现在特定行的图片自动向左滚动效果,你可以使用HTML、CSS和JavaScript结合来实现。下面是一个基本的例子: 首先,在HTML部分,假设你想让图片在`<tr>`标签下的`<td>`元素中滚动: ```html <table id="myTable"> <tr> <!-- 其他列... --> <td><img src="your-image-url" class="scrolling-image" alt="Image description"></td> </tr> </table> ``` 接着,在CSS中设置图片初始样式以及动画属性: ```css #myTable { overflow-x: auto; } .scrolling-image { display: inline-block; /* 保持图片可以水平移动 */ width: 100%; /* 图片宽度自适应 */ height: auto; white-space: nowrap; /* 防止文本换行影响图片 */ } ``` 最后,使用JavaScript控制图片滚动暂停: ```javascript // 获取图片元素 var img = document.querySelector('.scrolling-image'); // 设置滚动函数 function scrollImage() { img.scrollLeft += 5; // 每次滚动5像素 if (img.scrollLeft >= img.offsetWidth) { // 到达最右侧时停止滚动 clearInterval(imgScrollTimer); // 清除定时器 } } // 开始滚动 imgScrollTimer = setInterval(scrollImage, 50); // 每隔50毫秒滚动一次 // 添加鼠标悬停事件暂停滚动 img.addEventListener('mouseover', function() { clearInterval(imgScrollTimer); }); // 鼠标离开时恢复滚动 img.addEventListener('mouseout', function() { imgScrollTimer = setInterval(scrollImage, 50); }); ``` 在这个例子中,当鼠标悬停在图片上时,图片滚动暂停;当鼠标移开时,图片又会继续向左滚动
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值