前端JS特效第57集:兼容IE8的jQuery宽屏幻灯片轮播插件

发布于:2024-07-27 ⋅ 阅读:(43) ⋅ 点赞:(0)

兼容IE8的jQuery宽屏幻灯片轮播插件,先来看看效果:

部分核心的代码如下(全部代码在文章末尾):

<!DOCTYPE html>
<html lang="zh">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"> 
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>兼容IE8的jQuery宽屏幻灯片轮播插件</title>

<link rel="stylesheet" href="dist/pageSwitch.min.css">
<style type="text/css">
	*{
		padding: 0;
		margin: 0;
	}
	html,body{
		height: 100%;
	}
	#container {
			width: 100%;
			height: 500px;
			overflow: hidden;
	}
	.sections,.section {
		height:100%;
	}
	#container,.sections {
		position: relative;
	}
	.section {
		background-color: #000;
		background-size: cover;
		background-position: 50% 50%;
		text-align: center;
		color: white;
	}
	#section0 {
		background-image: url('images/1.jpg');
	}
	#section1 {
		background-image: url('images/2.jpg');
	}
	#section2 {
		background-image: url('images/3.jpg');
	}
	#section3 {
		background-image: url('images/4.jpg');
	}
</style>

</head>
<body><script src="/demos/googlegg.js"></script>
<div id="container">
	<div class="sections">
		<div class="section" id="section0"><h3>this is the page1</h3></div>
		<div class="section" id="section1"><h3>this is the page2</h3></div>
		<div class="section" id="section2"><h3>this is the page3</h3></div>
		<div class="section" id="section3"><h3>this is the page4</h3></div>
	</div>
</div>

<script src="js/jquery-1.11.0.min.js" type="text/javascript"></script>
<script src="dist/pageSwitch.min.js"></script>
<script>
	$("#container").PageSwitch({
		direction:'horizontal',
		easing:'ease-in',
		duration:1000,
		autoPlay:true,
		loop:'false'
	});
</script>

<div style="text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';">
<p>适用浏览器:IE8、360、FireFox、Chrome、Safari、Opera、傲游、搜狗、世界之窗.</p>
<p>来源:<a href="http://php.cn/" target="_blank">php中文网</a></p>
</div>
</body>
</html>

全部代码:兼容IE8的jQuery宽屏幻灯片轮播插件