jquery图片导航标签图片滑动门切换



84 334 112



特效描述:导航标签图 滑动门切换,jq实现图片切换,并且有文字介绍

代码结构

1. 引入CSS

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

2. 引入JS

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

3. HTML代码

<div id="viewer">
	<ul id="nav">
		<li class="thumb1"><a href="#panel1" class="on">Panel 1</a></li>
		<li class="thumb2"><a href="#panel2">Panel 2</a></li>
		<li class="thumb3"><a href="#panel3">Panel 3</a></li>
		<li class="thumb4"><a href="#panel4">Panel 4</a></li>
		<li class="thumb5"><a href="#panel5">Panel 5</a></li>
	</ul>
	<div id="panels">
		<div id="slider">
			<div id="panel1">
				<img src="img/image1.jpg" alt="Image 1">
				<p>Supernova 1994D, visible as the bright spot at the lower left, occurred in the outskirts of the disk galaxy NGC 4526.</p>
			</div>
			<div id="panel2">
				<img src="img/image2.jpg" alt="Image 2">
				<p>Radiation from hot stars off the top of the picture illuminates and erodes this giant, gaseous pillar.</p>
			</div>
			<div id="panel3">
				<img src="img/image3.jpg" alt="Image 3">
				<p>V838 Mon is located about 20,000 light-years away from Earth at the outer edge of the Milky Way.</p>
			</div>
			<div id="panel4">
				<img src="img/image4.jpg" alt="Image 4">
				<p>The Sombrero Galaxy is an unbarred spiral galaxy in the constellation Virgo approximately 30 million lights years away.</p>
			</div>
			<div id="panel5">
				<img src="img/image5.jpg" alt="Image 5">
				<p>This region of active current star formation is part of a diffuse emission nebula about 6,500 light-years away.</p>
			</div>
		</div>
	</div>
</div>
<script type="text/javascript">
(function($){
	//object containing margin settings
	var margins = {
		panel1: 0,
		panel2: -500,
		panel3: -1000,
		panel4: -1500,
		panel5: -2000
	}
	//handle nav click
	$("#nav a").click(function(e){
		//stop browser default
		e.preventDefault();
		//remove on states for all nav links
		$("#nav a").removeClass("on");
		//add on state to selected nav link
		$(this).addClass("on");
		//set margin of slider to move
		$("#slider").animate({
			marginLeft: margins[$(this).attr("href").split("#")[1]]
		});					
	});
	//hide descriptive text
	$("#slider p").hide();
	//show descriptive text on mouseover (hide on mouseout)
	$("#slider img").hover(
		function() {
			$(this).next().slideDown();
		}, function() {
			$(this).next().slideUp();
	});
})(jQuery);
</script>



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


热门标签: 滑动 滑块 滑动门 触屏滑动 滑动插件 滑块插件 滑动选项卡 滑动切换

×
×

注册

官方QQ群

扫描上面二维码加微信群

官方QQ群

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

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