码迷,mamicode.com
首页 > 其他好文 > 详细

jqery实现一个图标上下滑动效果

时间:2017-01-11 08:03:20      阅读:217      评论:0      收藏:0      [点我收藏+]

标签:cti   absolute   jquery   nav   动效   css   float   animate   pos   

技术分享

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title></title>
</head>
<style type="text/css">
.contain-foot-nav {
width: 33.3%;
float: left;
text-align: center;
position: relative;
}

.contain-foot-nav img {
display: block;
margin: 0 auto;
}

.foot-nav-top {
width: 100%;
height: 120px;
position: absolute;
}
.contain-foot-nav h2{
margin-top: 120px;
}
.contain-foot-nav h3 {
font-size: 16px;
color: #4CD1A2;
}

</style>
<body>
<div class="contain-foot-nav">
<div class="foot-nav-top">
<a href="tel://020-38353308"><img src="img/location.jpg"/></a>
</div>
<h2>联系电话</h2>
<h3>020-38353308</h3>
</div>
<script src="js/jquery-1.9.1.min.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">
$(function(){
var set = setInterval(function() {
top();
bottom();       //启动计时器
}, 1500);
top();
bottom();

function top() {
$(".foot-nav-top").animate({
top: "15px"
});
};

function bottom() {
$(".foot-nav-top").animate({
top: "1px"
});
};
$(".foot-nav-top").mouseenter(function() {
clearInterval(set);     //清除计时器
})
$(".foot-nav-top").mouseleave(function() {
set = setInterval(function() {    //启动计时器
top();
bottom();
}, 1500);
})

});
</script>
</body>
</html>

jqery实现一个图标上下滑动效果

标签:cti   absolute   jquery   nav   动效   css   float   animate   pos   

原文地址:http://www.cnblogs.com/luoguixin/p/6271924.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!