基于jQuery实现自适应图片幻灯片切换



59 234 79



特效描述:基于jQuery实现 自适应图片 幻灯片切换,基于jQuery实现自适应图片幻灯片切换

代码结构

1. 引入CSS

<link rel='stylesheet' id='nivoslider-css'  href='nivo-slider/wp-content/plugins/nivo-slider/scripts/nivo-slider/nivo-slider.css?ver=3.6.1' type='text/css' media='all' />
<link rel='stylesheet' id='twentytwelve-fonts-css'  href='http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700&#038;subset=latin,latin-ext' type='text/css' media='all' />
<link rel='stylesheet' id='twentytwelve-style-css'  href='nivo-slider/wp-content/themes/twentytwelve/style.css?ver=3.6.1' type='text/css' media='all' />
<link rel='stylesheet' id='twentytwelve-ie-css'  href='nivo-slider/wp-content/themes/twentytwelve/css/ie.css?ver=20121010' type='text/css' media='all' />
<link rel="stylesheet" type="text/css" media="screen" href="nivo-slider/wp-content/plugins/pc-custom-css/custom.css?pc_custom_css_ver=1359988231" />
<link rel='stylesheet' id='nivoslider-theme-bar-css'  href='nivo-slider/wp-content/plugins/nivo-slider/scripts/nivo-slider/themes/bar/bar.css?ver=3.6.1' type='text/css' media='all' />
<link rel='stylesheet' id='nivoslider-theme-dark-css'  href='nivo-slider/wp-content/plugins/nivo-slider/scripts/nivo-slider/themes/dark/dark.css?ver=3.6.1' type='text/css' media='all' />
<link rel='stylesheet' id='nivoslider-theme-default-css'  href='nivo-slider/wp-content/plugins/nivo-slider/scripts/nivo-slider/themes/default/default.css?ver=3.6.1' type='text/css' media='all' />
<link rel='stylesheet' id='nivoslider-theme-light-css'  href='nivo-slider/wp-content/plugins/nivo-slider/scripts/nivo-slider/themes/light/light.css?ver=3.6.1' type='text/css' media='all' />
<link rel='stylesheet' id='nivoslider-css'  href='nivo-slider/wp-content/plugins/nivo-slider/scripts/nivo-slider/nivo-slider.css?ver=3.6.1' type='text/css' media='all' />
<link rel='stylesheet' id='twentytwelve-fonts-css'  href='http://fonts.googleapis.com/css?family=Open+Sans:400italic,700italic,400,700&#038;subset=latin,latin-ext' type='text/css' media='all' />
<link rel='stylesheet' id='twentytwelve-style-css'  href='nivo-slider/wp-content/themes/twentytwelve/style.css?ver=3.6.1' type='text/css' media='all' />
<link rel='stylesheet' id='twentytwelve-ie-css'  href='nivo-slider/wp-content/themes/twentytwelve/css/ie.css?ver=20121010' type='text/css' media='all' />
<link rel="stylesheet" type="text/css" media="screen" href="nivo-slider/wp-content/plugins/pc-custom-css/custom.css?pc_custom_css_ver=1359988231" />
<link rel='stylesheet' id='nivoslider-theme-bar-css'  href='nivo-slider/wp-content/plugins/nivo-slider/scripts/nivo-slider/themes/bar/bar.css?ver=3.6.1' type='text/css' media='all' />
<link rel='stylesheet' id='nivoslider-theme-dark-css'  href='nivo-slider/wp-content/plugins/nivo-slider/scripts/nivo-slider/themes/dark/dark.css?ver=3.6.1' type='text/css' media='all' />
<link rel='stylesheet' id='nivoslider-theme-default-css'  href='nivo-slider/wp-content/plugins/nivo-slider/scripts/nivo-slider/themes/default/default.css?ver=3.6.1' type='text/css' media='all' />
<link rel='stylesheet' id='nivoslider-theme-light-css'  href='nivo-slider/wp-content/plugins/nivo-slider/scripts/nivo-slider/themes/light/light.css?ver=3.6.1' type='text/css' media='all' />

2. 引入JS

<script src="nivo-slider/wp-content/themes/twentytwelve/js/html5.js" type="text/javascript"></script>
<script type='text/javascript' src='nivo-slider/wp-includes/js/jquery/jquery.js?ver=1.10.2'></script>
<script type='text/javascript' src='nivo-slider/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1'></script>
<script type='text/javascript' src='nivo-slider/wp-content/plugins/nivo-slider/scripts/nivo-slider/jquery.nivo.slider.pack.js?ver=3.6.1'></script>
<script type='text/javascript' src='nivo-slider/wp-content/themes/twentytwelve/js/navigation.js?ver=1.0'></script>
<script src="nivo-slider/wp-content/themes/twentytwelve/js/html5.js" type="text/javascript"></script>
<script type='text/javascript' src='nivo-slider/wp-includes/js/jquery/jquery.js?ver=1.10.2'></script>
<script type='text/javascript' src='nivo-slider/wp-includes/js/jquery/jquery-migrate.min.js?ver=1.2.1'></script>
<script type='text/javascript' src='nivo-slider/wp-content/plugins/nivo-slider/scripts/nivo-slider/jquery.nivo.slider.pack.js?ver=3.6.1'></script>
<script type='text/javascript' src='nivo-slider/wp-content/themes/twentytwelve/js/navigation.js?ver=1.0'></script>

3. HTML代码

<!DOCTYPE html>
<!--[if IE 7]>
<html class="ie ie7" lang="en-US">
<![endif]-->
<!--[if IE 8]>
<html class="ie ie8" lang="en-US">
<![endif]-->
<!--[if !(IE 7) | !(IE 8)  ]><!-->
<html lang="en-US">
<!--<![endif]-->
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width" />
<title></title>
<!--[if lt IE 9]>
<![endif]-->
<!--[if lt IE 9]>
<![endif]-->
	<style type="text/css">.recentcomments a{display:inline !important;padding:0 !important;margin:0 !important;}</style>
	<style type="text/css" id="twentytwelve-header-css">
			.site-header h1 a,
		.site-header h2 {
			color: #444;
		}
		</style>
	<style type="text/css" id="custom-background-css">
body.custom-background { background-color: #e6e6e6; }
</style>
</head>
<body class="home page page-id-10 page-template page-template-page-templatesfull-width-php custom-background full-width custom-font-enabled single-author">
<div id="page" class="hfeed site">
	<div id="main" class="wrapper">
	<div id="primary" class="site-content">
		<div id="content" role="main">
	<article id="post-10" class="post-10 page type-page status-publish hentry">
		<div class="entry-content">
			<div class="slider-wrapper theme-default"><div class="ribbon"></div><div id="nivoslider-4" class="nivoSlider"><img src="nivo-slider/files/2013/02/5896103449_fa2c7a168d_b.jpg" alt="" /><img src="nivo-slider/files/2013/02/03037_liverpool_1920x1080.jpg" alt="" /><img src="nivo-slider/files/2013/02/3928848343_42443ae67d_o.jpg" alt="" /><img src="nivo-slider/files/2013/02/4207529693_d4f03f6dd7_o.jpg" alt="" /></div></div><script type="text/javascript">
jQuery(window).load(function(){
    jQuery("#nivoslider-4").nivoSlider({
        effect:"random",
        slices:15,
        boxCols:8,
        boxRows:4,
        animSpeed:500,
        pauseTime:3000,
        startSlide:0,
        directionNav:true,
        controlNav:true,
        controlNavThumbs:false,
        pauseOnHover:true,
        manualAdvance:false
    });
});
</script>
</div><!-- .entry-content -->
	</article><!-- #post -->
		</div><!-- #content -->
	</div><!-- #primary -->
	</div><!-- #main .wrapper -->
</div><!-- #page -->
<div style="text-align:center;clear:both">
</div>
</body>
</html>



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


热门标签: 图片拖动 图片放大镜 图片叠加 图片翻转旋转 图片延迟加载 图片淡出淡进 图片全屏 图片头像上传 二维码 滚动切换 滑动选项卡切换 图片广告 图片放大缩小 html5图片动画 带缩略图的幻灯片 地图 flash焦点图 图片滚动 图片滑动 图片切换 图片收缩展开 旋转木马 图片轮播 自动滚动图片轮播 图标导航菜单 选项卡切换 滑动手风琴 背景切换 手风琴 切换按钮 form表单 图表 焦点图幻灯片 图片 头像截图 图片切换 图片轮播 百叶窗 选项卡自动切换 按钮控制

×
×

注册

官方QQ群

扫描上面二维码加微信群

官方QQ群

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

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