帮助中心
获取牛币
联系我们
关于我们
版权声明
素材牛首页
微博登录
QQ登录
微信扫码登录
注册
登录
新浪微博
QQ登陆
微信登录
热门搜索:
小程序
支付
Java
后台模板
上传
商城模板
jQuery
手机
Thinkphp
微信
Vue.js
首 页
网页特效
整站源码
PHP实例
网站模版
工具箱
常用代码
论坛
游戏源码
资源分享
当前位置:
首页
»
精选常用代码
» jQuery顶部带有选项卡的焦点图效果
jQuery顶部带有选项卡的焦点图效果
浏览:586次
-
评论:0次
-
发布时间:2017-05-07
Html
Css
Js
1
2
3
4
5
page1
page2
page3
page4
page5
<
>
.win{ width:700px; height:300px; border:1px solid #ccc; margin:20px auto; position:relative; overflow: hidden; } .title{ width:100%; height:30px; background:#eee; position: relative; } .title a{ width:20%; height:100%; float:left; text-align:center; line-height:30px; font-size:15px; color:#009797; text-decoration:none; position:relative; z-index:1; } .title .float{ width:20%; height:100%; background:#009797; position:absolute; } .box{ width:100%; height:270px; position:relative; } .box div{ width:100%; height:100%; position:absolute; left:-100%; font-size:70px; text-align:center; line-height:270px; top:0; color:#fff; } .rightB{ width:50px; height:70px; font-size:20px; color:#fff; background:rgba(0,0,0,0.5); position:absolute; right:0; top:45%; line-height:70px; text-align:center; cursor:pointer; display: none; } .leftB{ width:50px; height:70px; font-size:20px; color:#fff; background:rgba(0,0,0,0.5); position:absolute; left:0; top:45%; line-height:70px; text-align:center; cursor:pointer; display:none; } .color1{background:#FFB12F;} .color2{background:#00C378;} .color3{background:#26B2E3;} .color4{background:#E84C3D;} .color5{background:#F831FD;}
$(function(){ var win=$(".win"); var links=$(".title a"); var float=$(".float"); var divs=$(".box div"); var num1=0; //当前内容的下标 var num2=0; win.hover(function(){ $(".leftB,.rightB").css("display","block"); },function(){ $(".leftB,.rightB").css("display","none"); }); $(".leftB").click(function(){ divs.finish(); float.stop(true); var temp=num1; num1--; if(num1==-1){ num1=4; } divs.eq(num1).css("left",700).animate({left:0}); divs.eq(temp).animate({left:-700}); links.css("color","#009797"); float.animate({ left:links.eq(num1).position().left }) links.eq(num1).css("color","#fff"); }); $(".rightB").click(function(){ divs.finish(); float.stop(true); var temp=num1; num1++; if(num1==5){ num1=0; } divs.eq(num1).css("left",-700).animate({left:0}); divs.eq(temp).animate({left:700}); links.css("color","#009797"); float.animate({left:links.eq(num1).position().left}) links.eq(num1).css("color","#fff"); }); links.hover(function(){ //滑块操作 divs.finish(); float.stop(true); links.css("color","#009797"); var that=$(this); var lefts=$(this).position().left; float.animate({left:lefts},function(){ that.css("color","#fff"); }) //滑块操作 //内容变化 var index=$(this).index(".title a"); num2=index; if(num1==num2){ return; }else if(num1
num2){ divs.eq(num2).css("left",-700).animate({left:0}); divs.eq(num1).animate({left:700}); } num1=num2; num2=""; },function(){ }) })
↑上面代码改变,会自动显示代码结果
jQuery调用版本:
1.9.0
<!doctype html><html><head><meta charset="utf-8"><title>jQuery顶部带有选项卡的焦点图效果-www.sucainiu.com</title><script src="https://libs.baidu.com/jquery/1.9.0/jquery.min.js"></script><style>
</style></head><body>
<script>
</script>
</body></html>
立即下载
收藏
积分说明:注册即送10牛币,每日签到可获得5牛币,成为VIP会员可永久免牛币下载!
充值积分
充值会员
更多说明»
代码描述:它实现了顶部带有选项卡的焦点图效果。当鼠标悬浮选项卡可以实现图片切换,点击左右箭头也可以实现切换效果。
触发事件返回顶部
输入邮箱自动补全后缀效果代码实例
讨论这个常用代码(0)
回答他人问题或分享心得会奖励牛币
〒_〒 居然一个评论都没有……
文明上网,理性发言! 😉 阿里云幸运券,
戳我领取
发表评论
提交回复
我的积分余额:
0
已下载次数:
586
所需牛币:
5
开始下载
牛币获取:
签到、评论、充值
» 在线充值
(10牛币=1元)
成为VIP可永久免积分下载全部常用代码
» 查看详情
VIP
客服
签到
充值