jquery仿猎豹浏览器图标导航控制图片淡出淡进滑动切换代码



131 523 175



特效描述:图标导航 淡出淡进 滑动切换,

代码结构

1. 引入JS

<script type="text/javascript" src="js/jquery.js"></script>

2. HTML代码

<div id="j-focusPic">
	<div class="screen j-slider" flag="0" style="position: absolute;width: 100%;">
		<div class="movie"><img src="images/lead1.jpg" /></div>
		<div class="movie on" ><img src="images/lead2.jpg" /></div>
		<div class="movie on" index="2"><img src="images/lead3.jpg" /></div>
		<div class="movie on" index="3"><img src="images/lead4.jpg" /></div>
		<div class="movie on" index="4"><a class="button" href="javascript:;"></a><img src="images/lead5.jpg" /></div>
	</div>
</div>
<div class="navigation">
	<dt>
		<dl class="t1" index="0"><div class="tm"></div></dl>
		<dl class="t2" index="1"><div class="tm"></div></dl>
		<dl class="t3" index="2"><div style="margin-left:1px;" class="tm"></div></dl>
		<dl class="t4" index="3"><div class="tm"></div></dl>
		<dl class="t5" index="4"><div class="tm"></div></dl>
	</dt>
</div>
<script type="text/javascript">
(function(){
	var $width=$(document).width();
    var getIndex=0;
	var interFlag=true;
	var movieInter=null;
	var focuMovie=$("#j-focusPic .movie");
	var btn=$(".navigation dt dl");
	$(".navigation dt dl .tm").eq(0).css("opacity",0);
	focuMovie.each(function(i){
		if(i!==0) $(this).css("left",$width);
	})
	//导航滑过
	btn.mouseover(function(){
		if(interFlag){
			clearInterval(movieInter);
			clearInterval(movieTime);
			interFlag=false;
		}
		var j=$(this).attr("index");
		var anim=-$width;
		var object=$(this);
		if(getIndex<j) anim=$width;
		if(getIndex==j) return;
		anmtion(getIndex,j,anim,object);
		getIndex=j;
	})
	var anmtion=function(i,j,anim,object){
		btn.each(function(k){
			var _this=$(this).find(".tm");
			_this.animate({ opacity: 1},{queue :false}, 200 );
		})
		var _this_=object.find(".tm");
		_this_.animate({ opacity: 0},{queue :false}, 200 );
		var num=40;
		focuMovie.eq(i).animate({
			//left : anim,
			opacity : "0"
		},{	duration: 800,
			queue :false,
			complete: function(){
				focuMovie.eq(i).css("left",anim);
			}
		});
		if(anim==$width) num=-40;
		focuMovie.eq(j).animate({
			left : num,
			opacity : "1"
		},{ 
			duration: 800,
			queue :false,
			complete: function(){
					focuMovie.eq(j).animate({
						left : 0
					},{ queue :false,
						complete: function(){
							for(var t=0;t<5;t++){
								if(t>j) focuMovie.eq(t).css("left",$width+40);
								if(t<j) focuMovie.eq(t).css("left",-$width-40);
							}
						}
					});
			}
		});
	};
	//立即进入
	$(".button").click(function(){
		window.location.href = "http://www.17sucai.com";
		//setRequest();
	})
	//自动播放
	var movieTime=setTimeout(function(){
		var ii=getIndex+1;
		var id=btn.eq(ii);
		anmtion(getIndex,ii,$width,id);
		getIndex=ii;
		movieInter=setInterval(function(){
			var jj=getIndex+1;
			if(jj>=4) clearInterval(movieInter);
			var object=btn.eq(jj);
			anmtion(getIndex,jj,$width,object);
			getIndex=jj;
		},5000);
	},3000);
	var request=function(names){
		if(names){
			var URLParams = "";
			var aParams = document.location.search.substr(1).split('&');
			for (i=0; i < aParams.length ; i++){
				var aParam = aParams[i].split('=');
				if (aParam[0]==names)
					URLParams = aParam[1];
			}
			return URLParams;
		}
	};
})();
</script>



用户评论
大牛,别默默的看了,快登录帮我点评一下吧!:)      登录 | 注册


热门标签: flash导航菜单 flash导航条 flash导航 flash菜单 flash下拉菜单 flash下拉导航菜单 导航切换 菜单切换 浮动菜单 浮动导航 收缩菜单 收缩导航 右键菜单 滑动导航菜单 滑动导航 滑动菜单 滚动导航菜单 滚动菜单 滚动导航 h5动画导航 h5动画菜单 html5动画导航 html5动画菜单 滚动切换 滚动条切换 滑动选项卡 滑动切换 滑动手风琴 选项卡切换 选项卡 切换 tab切换 页面切换 选项卡插件 切换插件 导航菜单 导航条 菜单栏 导航栏 分类导航 响应式导航条 响应式导航 图标导航 图标菜单 选项卡自动切换

×
×

注册

官方QQ群

扫描上面二维码加微信群

官方QQ群

jQuery/js讨论群
群号:642649996
Css3+Html5讨论群
群号:322131262

加群请备注:从官网了解到