利用jquery实现图文内容自动播放



46 181 61



特效描述:利用jquery实现 图文内容 自动播放,利用jquery实现图文内容自动播放

代码结构

1. 引入CSS

<link rel="stylesheet" href="css/jshowoff.css" type="text/css" media="screen, projection" />
<link rel="stylesheet" href="css/jshowoff.css" type="text/css" media="screen, projection" />

2. 引入JS

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

3. HTML代码

<!DOCTYPE html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title></title>
<script type="text/javascript" src="js/jquery.min.js"></script> 
</head>
<body id="home">
<div id="wrap">
		<div id="about">
		<h1>jShowOff: a jQuery Content Rotator</h1>
		<p>jShowOff is a jQuery plugin for creating a rotating content module. It works by creating 'slides' from the child elements (eg. <code>&lt;li&gt;</code>) inside a specified wrapper element (eg. <code>&lt;ul&gt;</code>) on which <code>.jshowoff()</code> is invoked. It then rotates through the slides, with options for controls, links, and more.  This type of module is often used to promote pages, sections, or features on a site.</p>
		<h2>Required Files</h2>
		<ol>
			<li>the jQuery Core JavaScript Library (1.3+)</li>
			<li>jquery.jshowoff.min.js</li>
		</ol>
		<p>To get jShowOff up and running, simply include the above files on your page, create the required slides markup and invoke the method (example below).  You can use the default skin (jshowoff.css) from the demo, or restyle the elements to your liking. <span class="note">NOTE: Source files are maintained at github.com/ekallevig/jShowOff.</span></p>
		<h2>How to Use</h2>
		<p>The required markup for jShowOff is a parent element with one or more child elements, which are used as the 'slides'. The following is a basic example:</p>
		<pre><code>&lt;div id="features"&gt;
	&lt;div&gt;&lt;p&gt;This is a slide!&lt;/p&gt;&lt;/div&gt;
	&lt;div&gt;&lt;a href="http://google.com"&gt;&lt;img src="http://www.google.com/intl/en_ALL/images/logo.gif" alt="Google Logo" /&gt;&lt;/a&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;script type="text/javascript"&gt;		
	$(document).ready(function(){ $('#features').jshowoff(); });
&lt;/script&gt;</code></pre>
		<h2>Options</h2>
		<p>jShowOff has several options for customization.  Pass these settings as an object to the <code>.jshowoff()</code> method like this:</p>
		<pre><code>$('#features').jshowoff({ speed:1500, links: false }); });</code></pre>		
		<table id="options" cellpadding="0" cellspacing="0">
			<col />
			<col />
			<col width="120" />
			<col />
			<tr>
				<th>Property</th>
				<th>Type</th>
				<th>Default</th>
				<th>Description</th>
			</tr>
			<tr>
				<td>animatePause</td>
				<td>boolean</td>
				<td>true</td>
				<td>Whether to use 'Pause' animation text when pausing.</td>
			</tr>
			<tr>
				<td>autoPlay</td>
				<td>boolean</td>
				<td>true</td>
				<td>Whether to start playing immediately.</td>
			</tr>
			<tr>
				<td>changeSpeed</td>
				<td>integer</td>
				<td>600</td>
				<td>Speed of transition in milliseconds.</td>
			</tr>
			<tr>
				<td>controls</td>
				<td>boolean</td>
				<td>true</td>
				<td>Whether to create &amp; display controls (Play/Pause, Previous, Next).</td>
			</tr>
			<tr>
				<td>controlText</td>
				<td>object</td>
				<td>{ play:'Play', pause:'Pause', previous:'Previous', next:'Next' }</td>
				<td>Text to use for controls (Play/Pause, Previous, Next). For multi-language support, etc.</td>
			</tr>
			<tr>
				<td>cssClass</td>
				<td>string</td>
				<td>true</td>
				<td>Add an additional custom class to the .jshowoff wrapper.</td>
			</tr>
			<tr>
				<td>effect</td>
				<td>string</td>
				<td>'fade'</td>
				<td>Type of transition effect: 'fade', 'slideLeft' or 'none'.</td>
			</tr>
			<tr>
				<td>hoverPause</td>
				<td>boolean</td>
				<td>true</td>
				<td>Whether to pause on hover.</td>
			</tr>
			<tr>
				<td>links</td>
				<td>boolean</td>
				<td>true</td>
				<td>Whether to create &amp; display numeric links to each slide.</td>
			</tr>
			<tr>
				<td>speed</td>
				<td>integer</td>
				<td>3000</td>
				<td>Time each slide is shown in milliseconds.</td>
			</tr>
		</table>
		</div><!--end #about-->
		<div id="demo">
			<div id="features">
				<div><a href="http://51qianduan.com/"><img src="images/4303103738_a4745a3e6d_o.jpg" alt="Shore" /></a></div>
				<div><img src="images/4302354579_2a16dcb3cd_o.jpg" alt="Eddie" class="eddie" /><h2>HTML Slide</h2><p>Example of an HTML slide.</p><p>Lorem ipsum dolor sit amet, nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p><p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam.</p><p><a href="http://51qianduan.com/">Learn More &#8250;</a></p></div>	
				<div><a href="http://51qianduan.com/"><img src="images/4302354517_d72d321f17_o.jpg" alt="Flower" /></a></div>
				<div><a href="http://51qianduan.com/"><img src="images/4303103822_a3b23ff7f5_o.jpg" alt="Fern" /></a></div>
			</div>
			<script type="text/javascript">		
				$(document).ready(function(){ $('#features').jshowoff(); });
			</script>
			<h2>Sliding Effect &amp; Custom Labels Demo</h2>
			<div id="slidingFeatures">
				<div title="Shore"><a href="http://51qianduan.com/"><img src="images/4303103738_a4745a3e6d_o.jpg" alt="Shore" /></a></div>
				<div title="Dog"><img src="images/4302354579_2a16dcb3cd_o.jpg" alt="Eddie" class="eddie" /><h2>HTML Slide</h2><p>Example of an HTML slide.</p><p>Lorem ipsum dolor sit amet, nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p><p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam.</p><p><a href="http://51qianduan.com/">Learn More &#8250;</a></p></div>	
				<div title="Flower"><a href="http://51qianduan.com/"><img src="images/4302354517_d72d321f17_o.jpg" alt="Flower" /></a></div>
				<div title="Fern"><a href="http://51qianduan.com/"><img src="images/4303103822_a3b23ff7f5_o.jpg" alt="Fern" /></a></div>
			</div>
			<script type="text/javascript">		
				$(document).ready(function(){ $('#slidingFeatures').jshowoff({
					effect: 'slideLeft',
					controlText:{play:'Reproducir',pause:'Pausar',previous:'Anterior',next:'Siguiente'},
					hoverPause: false
				}); });
			</script>
			<h2>Control-less, Effect-less Demo</h2>
			<div id="basicFeatures">
				<div title="Shore"><a href="http://51qianduan.com/"><img src="images/4303103738_a4745a3e6d_o.jpg" alt="Shore" /></a></div>
				<div title="Dog"><img src="images/4302354579_2a16dcb3cd_o.jpg" alt="Eddie" class="eddie" /><h2>HTML Slide</h2><p>Example of an HTML slide.</p><p>Lorem ipsum dolor sit amet, nibh euismod tincidunt ut laoreet dolore magna aliquam erat volutpat.</p><p>Lorem ipsum dolor sit amet, consectetuer adipiscing elit, sed diam.</p><p><a href="http://51qianduan.com/">Learn More &#8250;</a></p></div>	
				<div title="Flower"><a href="http://51qianduan.com/"><img src="images/4302354517_d72d321f17_o.jpg" alt="Flower" /></a></div>
				<div title="Fern"><a href="http://51qianduan.com/"><img src="images/4303103822_a3b23ff7f5_o.jpg" alt="Fern" /></a></div>
			</div>
			<script type="text/javascript">		
				$(document).ready(function(){ $('#basicFeatures').jshowoff({ 
					links: false,
					controls: false,
					effect: 'none',
					cssClass: 'basicFeatures',
					hoverPause: false 
				}); });
			</script>
			<h2>Re-styled Thumbnail Demo</h2>
			<div id="thumbFeatures">
				<div><a href="http://51qianduan.com/"><img src="images/4438272805_0abbbbaff2_o.jpg" alt="Mountain" /></a></div>
				<div><a href="http://51qianduan.com/"><img src="images/4439049486_ec397f1d76_o.jpg" alt="Mountain" /></a></div>
				<div><a href="http://51qianduan.com/"><img src="images/4439049454_d5e54a53f7_o.jpg" alt="Mountain" /></a></div>
				<div><a href="http://51qianduan.com/"><img src="images/4438272741_b26665f2c4_o.jpg" alt="Mountain" /></a></div>
			</div>
			<script type="text/javascript">		
				$(document).ready(function(){ $('#thumbFeatures').jshowoff({ 
					cssClass: 'thumbFeatures',
					effect: 'slideLeft'
				}); });
			</script>
		</div><!--end #demo-->
<div style="text-align:center;clear:both">
</div>
</div><!--end #wrap-->
<script type="text/javascript">
// fix pre overflow in IE
(function ($) {
	$.fn.fixOverflow = function () {
		if ($.browser.msie) {
			return this.each(function () {
				if (this.scrollWidth > this.offsetWidth) {
					$(this).css({ 'padding-bottom' : '20px', 'overflow-y' : 'hidden' });
				}
			});
		} else {
			return this;
		}
	};
})(jQuery);
$('pre').fixOverflow();
</script>
</body>
</html>



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


热门标签: 滑动导航菜单 导航切换 图片淡出淡进 图片头像上传 滑动选项卡切换 文字淡出淡进 文件上传 图片滑动 图片切换 文本框 文字滑动 文字切换 下拉框 滑动手风琴 背景切换 复选 滑动星星打分 手风琴 单选 选项卡自动切换 登录框 视频切换 注册框 列表切换 搜索框 验证码 渐隐切换 二级联动 全屏切换 三级联动 切换按钮 城市选择 缩放切换 value赋值 筛选 按钮控制 购物车 颜色选择 表单提交 全选/反选 添加删除 添加标签 密码强度验证 表单验证 html5按钮动画 按钮样式 密码修改设置 滑动滑过 滚动切换 滑动选项卡切换 选项卡切换 滑动手风琴 渐隐切换 淡出淡入淡进 切换按钮 form表单

×
×

注册

官方QQ群

扫描上面二维码加微信群

官方QQ群

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

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