当前位置: 移动技术网 > IT编程>开发语言>JavaScript > jquery实现图片渐变切换兼容ie6/Chrome/Firefox

jquery实现图片渐变切换兼容ie6/Chrome/Firefox

2019年01月19日  | 移动技术网IT编程  | 我要评论

代码如下:


<!doctype html public "-//w3c//dtd xhtml 1.0 transitional//en" "https://www.w3.org/tr/xhtml1/dtd/xhtml1-transitional.dtd">
<html xmlns="https://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta name="author" content="nancle from cau cs101" />
<title>jquery图片渐变切换</title>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<style type="text/css">
ul{position:relative;}
ul li{display:block; position:absolute; left:0; top:0}
img{width:480px; height:320px; border:5px solid #ccc}
</style>
</head>
<body>
<ul>
<li><img src=https://www.2cto.com/uploadfile/2018/0414/20180414015957532.jpg" /></li>
<li><img src=https://www.2cto.com/uploadfile/2018/0414/20180414015957761.jpg" /></li>
<li><img src=https://www.2cto.com/uploadfile/2018/0414/20180414015957611.jpg" /></li>
<li><img src=https://www.2cto.com/uploadfile/2018/0414/20180414015957645.jpg" /></li>
</ul>
</p>
<script>
var switchspeed = 1000; //图片切换时间
var fadespeed = 1500; //渐变时间
setinterval(function(){
$('img').last().fadeout(fadespeed, function(){
$(this).show().parent().prependto($('ul'));
});
}, switchspeed);
</script>
</body>
</html>

如对本文有疑问, 点击进行留言回复!!

相关文章:

验证码:
移动技术网