jQuery实现鼠标经过像翻页和描点链接效果

前端之家收集整理的这篇文章主要介绍了jQuery实现鼠标经过像翻页和描点链接效果前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

@H_301_0@在百度地图api首页经常见到当鼠标经过像翻页和描点链接效果,基于jquery和js代码是如何实现的呢?下面小编给大家分享关键代码,一起看下吧!


<div class="jb51code">
<pre class="brush:js;">
var timer;
$("li").on("mouSEOver",function(){
clearTimeout(timer);
timer=null;
$(this).addClass("active");
$(this).siblings().removeClass("active");
var $index=$(this).index();
/$(".wrapper").animate({top:-$index300});/
timer=setTimeout(function(){
$(".wrapper").animate({top:-$index
300});
},300)
});
$('.dd').find($(".cc")).hover(function(){
$(this).find(".c1").stop().animate({width:0},100,function(){
$(this).hide().next().show().animate({width:300},100);
})
},function(){
$(this).find(".c2").animate({width:0},function(){
$(this).hide().prev().show().animate({width:300},100);
})
});
*{margin:0;padding:0;Box-sizing:border-Box}
ul{list-style:none;border:1px solid #ccc;border-radius:5px;width:900px;margin:30px auto 10px;}
.clearfix{zoom:1;}
.clearfix:after{content:".";display:block;width:0;height:0;visibility:hidden;clear: both;}
li{float:left;border-right:1px solid #ccc;width:20%;text-align:center;height:30px;line-height:30px;cursor:pointer;}
li:last-child{border:none;}
li.active{background-color:#0099cc;color:#fff;}
.container,.wrapper,.con{height:300px;}
.container{width:900px;margin:0 auto;position:relative;overflow:hidden;}
.wrapper{position:relative;top:0;}
.con{line-height:300px;text-align:center;border:1px solid #ccc;}
.dd{margin: 30px auto;width:1200px;}
.cc{float:left;width:300px;height:200px;overflow:hidden;margin:20px;}
.c1,.c2{width:100%;height:100%;margin:0 auto;text-align:center;line-height:200px;cursor:pointer;overflow:hidden}
.c1{background-color:#c01110;}
.c2{background-color:#0099cc;}
<!DOCTYPE html>

Meta charset="UTF-8">
  • 选项2
  • 选项3
  • 选项4
  • 选项5
@H_301_0@

下面给大家介绍下锚点链接

@H_301_0@1)引入jquery

@H_301_0@2)给a标签设置class smooth

@H_301_0@3)

@H_301_0@以上所述是小编给大家介绍的jQuery实现鼠标经过像翻页和描点链接效果。编程之家 jb51.cc 收集整理的教程希望能对你有所帮助,如果觉得编程之家不错,可分享给好友!感谢支持

原文链接:https://www.f2er.com/jquery/46713.html

猜你在找的jQuery相关文章