首页 > 代码库 > jquery视差图片切换
jquery视差图片切换
<!DOCTYPE html> | |
<html> | |
<head> | |
<meta charset="UTF-8"> | |
<title>视差图片文字切换</title> | |
<script src="http://www.mamicode.com/js/jquery-2.1.0.js"></script> | |
<style> | |
.box { | |
width:750px; | |
height: 750px; | |
border: 1px solid red; | |
overflow: hidden; | |
margin-left: 300px; | |
position: absolute; | |
background:url("img/DSC05940.JPG")no-repeat center; | |
} | |
img { | |
width: 1000px; | |
height: 750px; | |
position: absolute; | |
} | |
.fontbox{ | |
width:3750px; | |
height: 750px; | |
position: absolute; | |
left: 0; | |
} | |
.font{ | |
float: left; | |
width: 750px; | |
height: 750px; | |
line-height: 750px; | |
text-align: center; | |
font-size: 80px; | |
} | |
</style> | |
</head> | |
<body> | |
<div class="box"> | |
<img src="http://www.mamicode.com/img/DSC05940.JPG" /> | |
<div class="fontbox"> | |
<div class="font">1</div> | |
<div class="font">2</div> | |
<div class="font">3</div> | |
<div class="font">4</div> | |
</div> | |
</div> | |
</body> | |
<script> | |
$("img").animate({ | |
left: "-50px" | |
}, 1000).animate({ | |
left: "-100px" | |
}, 1000).animate({ | |
left: "-150px" | |
}, 1000).animate({ | |
left: "-200px" | |
},1000) | |
$(".fontbox").animate({ | |
left:"-750px" | |
},2000).animate({ | |
left:"-1500px" | |
}).animate({ | |
left:"-2250" | |
}) | |
</script> | |
</html> |
jquery视差图片切换
声明:以上内容来自用户投稿及互联网公开渠道收集整理发布,本网站不拥有所有权,未作人工编辑处理,也不承担相关法律责任,若内容有误或涉及侵权可进行投诉: 投诉/举报 工作人员会在5个工作日内联系你,一经查实,本站将立刻删除涉嫌侵权内容。