js图片循环滚动代码(js图片循环滚动代码大全)
admin 发布:2022-12-19 06:14 132
今天给各位分享js图片循环滚动代码的知识,其中也会对js图片循环滚动代码大全进行解释,如果能碰巧解决你现在面临的问题,别忘了关注本站,现在开始吧!
本文目录一览:
JS图片滚动怎么让鼠标经过后停止啊?
我写的代码,要下班了,所以就简单注释一下。鼠标经过会停止,移开鼠标会继续走。已经测试过了。另存xx.htm打开可看效果。
1234567891011121314151617181920212223242526272829303132script type="text/javascript"var timer_movex;start_timer(); function start_timer(){ timer_movex = setInterval(function() {//setInterval是js循环定时器每隔一段时间就执行一次function代码 var x = document.getElementById('x');//获得id为x的html元素 if(x.offsetLeft = 800) x.style.left = 0;//如果移动到了800的位置,则跳回左边0点重新开始移动 else x.style.left = x.offsetLeft + 50;//向右移动20个像素}, 1000);//每隔1000毫秒移动一次} function stop_timer() { clearInterval(timer_movex);} function movex(v) { var x = document.getElementById('x');//获得id为x的html元素 x.style.left = x.offsetLeft + v;//移动v个像素,v为正数则向右,负数则向左。x.style.left即为左边框位置。}/scriptdiv id="x" style="position:absolute; left:500px; top:100px; width:100px; height:100px; border=1px solid #000;" onmouseover="stop_timer()" onmouseout="start_timer()"h1TEST/h1/divforminput id="test" onclick="movex(-100)" value="点击左移" type="button"/input id="test" onclick="movex(100)" value="点击右移" type="button"/input id="test" onclick="start_timer()" value="start" type="button"/input id="test" onclick="stop_timer()" value="stop" type="button"//form
js高手进,如何能让鼠标停在图片上的时候停止滚动
#box1 div:hover{
animation-play-state: paused;
}
animation--play-state属性指定动画是否正在运行或已暂停。
语法: animation-play-state: paused|running;
paused 指定暂停动画
running 指定正在运行的动画
js实现图片左右滚动
代码:
title/title
style
body{
margin:0;
padding:0;
background-color:transparent;
}
div{
width:350px;
overflow:hidden;
}
table img{
width:100px;
height:100px;
}
/style
/head
body
div id="picScroll"
table
tr
tdaimg src="../pic/1.jpg" //a/td
tdaimg src="../pic/2.jpg"/a/td
tdaimg src="../pic/3.jpg"/a/td
tdaimg src="../pic/4.jpg"/a/td
tdaimg src="../pic/5.jpg"/a/td
/tr
/table
/div
/body
/html
script
var target = $('#picScroll');
var left = 0;
var speed = 30;
function Marqeen() {
if (target[0].offsetWidth = left) {
left -= target[0].offsetWidth;
}
else {
left++;
}
target.scrollLeft(left);
}
$(function () {
var marQueen = window.setInterval(Marqeen, speed);
target.mouseover(function () {
clearInterval(marQueen);
});
target.mouseout(function () {
marQueen = window.setInterval(Marqeen, speed);
});
});
/script
关于js图片循环滚动代码和js图片循环滚动代码大全的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。
版权说明:如非注明,本站文章均为 AH站长 原创,转载请注明出处和附带本文链接;
相关推荐
- 05-20优化,优化图片清晰度软件
- 05-19黄冈网站推广软件费用是多少,免费的短视频app大全下载
- 05-18企业网站模板,企业网站模板图片
- 05-17广告公司,广告公司名字大全创意
- 05-14交易链接大全,交易链接是什么意思
- 05-13网络推广教程,网络推广技巧大全
- 05-13比较有名的个人网站,个人网站取名大全
- 05-12优秀软文营销范文,优秀软文营销范文大全
- 05-09网页代码,网页代码快捷键
- 05-06单页网站的代码(完整的网页代码)[20240506更新]
取消回复欢迎 你 发表评论:
- 标签列表
- 最近发表
- 友情链接