jQuery左右箭头控制焦点图片左右滚动特效代码下载


jQuery左右箭头控制焦点图片左右滚动特效代码下载
jQuery左右箭头控制焦点图片左右滚动特效代码下载以及左右箭头控制、焦点图片、左右滚动等js/jquery网页特效代码下载。

1. 引入CSS

<link rel="stylesheet" type="text/css" href="css/style.css" />

2. 引入JS

<script type="text/javascript" src="js/jquery-1.6.4.min.js"></script>
<script type="text/javascript" src="js/mg.js"></script>

3. HTML代码

<div class="game_pic_tab">
	<div id="slider-item-0" class="game_pic">
		<img src="images/5326d5867874d.jpg" width="600" height="248" alt="决战喵星 Naughty Kitties" title="决战喵星 Naughty Kitties" />
	</div>
	<div id="slider-item-1" class="game_pic">
		<img src="images/532038aaa9602.jpg" width="600" height="248" alt="无敌弹珠 Smash Hit" title="无敌弹珠 Smash Hit" />
	</div>
	<div id="slider-item-2" class="game_pic">
		<img src="images/53144d2392623.jpg" width="600" height="248" alt="超越空间 Beyond Space" title="超越空间 Beyond Space" />
	</div>
	<div id="slider-item-3" class="game_pic">
		<img src="images/53144d0c5fec7.jpg" width="600" height="248" alt="神之光金币版 God of Light" title="神之光金币版 God of Light" />
	</div>
	<div id="slider-item-4" class="game_pic">
		<img src="images/5306c84e70a72.jpg" width="600" height="248" alt="又一个案件解决了 Another Case Solved" title="又一个案件解决了 Another Case Solved" />
	</div>
	<div id="slider-click-prev" class="game_pic_icon game_pic_icon_l">Prev</div>
	<div id="slider-click-next" class="game_pic_icon game_pic_icon_r">Next</div>
	<div class="prev_l"></div>
	<div class="next_r"></div>
</div>
<script type="text/javascript"> 
$(document).ready(function(){
	var slider = new Mg({
		reference : "slider",
		click : {
			activated : [ 0 ],
			cycle : true,
			multiMode : 'centered',
			interactive : true,
			multiLess : 2,
			multiPlus : 2,
			auto : 3000,
			autoSlow : 5000
		}
	});
	slider.click.onEvent = function(){
		$("#" + this.reference + "-item-" + this.deactivated).removeClass("active");
		$("#" + this.reference + "-item-" + this.activated).addClass("active");
		$('[id^="' + this.reference + '-item-"]').css("display","none");
		var arr = this.multiActivated;
		for ( var i = 0; i < arr.length; i++) {
			var depth = Math.abs(slider.mapDistanceReverse(
				this.multiPlus, i, arr.length, 0)); // Parameters: center, num, max, min
				var path = $("#" + this.reference + "-item-" + arr[i]);
				path.css("position", "absolute").css("z-index", depth);
				path.css("display", "block").css("position", "absolute").animate({left : ((i - 2) * 604 + 190) + "px"},500);
		}
	}
	slider.init();
});
</script>

相关推荐

发表评论

相关文章