教育jquery实现图片放大插件



70 276 93



特效描述:教育jquery实现 图片放大插件,教育jquery实现图片放大插件

代码结构

1. 引入CSS

<link rel="stylesheet" href="css/screen.css" media="screen"/>
<link rel="stylesheet" href="css/lightbox.css" media="screen"/>

2. 引入JS

<script src="js/jquery-1.10.2.min.js"></script>
<script src="js/lightbox-2.6.min.js"></script>

3. HTML代码

<div class="wrapper">
	<section id="intro" class="section intro-section">
		<header>
			<h1 class="logo">Lightbox<em class="version">2.6</em></h1>
		</header>
		<p class="author">
			by Lokesh Dhakar<br />
	  </p>
		<p class="lead">
	  Lightbox是很小javascript库用来展示图片相册的插件。</p>
  </section>
	<section id="examples" class="section examples-section">
		<header>
			<h2 class="section-header">Examples</h2>
		</header>
		<h3>Single images</h3>
		<div class="image-row">
			<a class="example-image-link" href="img/demopage/image-1.jpg" data-lightbox="example-1"><img class="example-image" src="img/demopage/thumb-1.jpg" alt="thumb-1" width="150" height="150"/></a>
			<a class="example-image-link" href="img/demopage/image-2.jpg" data-lightbox="example-2" title="Optional caption."><img class="example-image" src="img/demopage/thumb-2.jpg" alt="thumb-1" width="150" height="150"/></a>
		</div>
		<h3 style="clear: both;">An image set</h3>
		<div class="image-row">
			<div class="image-set">
				<a class="example-image-link" href="img/demopage/image-3.jpg" data-lightbox="example-set" title="Click on the right side of the image to move forward."><img class="example-image" src="img/demopage/thumb-3.jpg" alt="Plants: image 1 0f 4 thumb" width="150" height="150"/></a>
				<a class="example-image-link" href="img/demopage/image-4.jpg" data-lightbox="example-set" title="Or press the right arrow on your keyboard."><img class="example-image" src="img/demopage/thumb-4.jpg" alt="Plants: image 2 0f 4 thumb" width="150" height="150"/></a>
				<a class="example-image-link" href="img/demopage/image-5.jpg" data-lightbox="example-set" title="The script preloads the next image in the set as you're viewing."><img class="example-image" src="img/demopage/thumb-5.jpg" alt="Plants: image 3 0f 4 thumb" width="150" height="150"/></a>
				<a class="example-image-link" href="img/demopage/image-6.jpg" data-lightbox="example-set" title="Click anywhere outside the image or the X to the right to close."><img class="example-image" src="img/demopage/thumb-6.jpg" alt="Plants: image 4 0f 4 thumb" width="150" height="150"/></a>
			</div>
		</div>
	</section>
	<section id="how-to-use" class="section how-to-use-section">
		<header>
			<h2 class="section-header">How to use</h2>
			<h2 class="section-subheader">Step-by-step instructions</h2>
		</header>
		<h3>Part 1 - Get setup</h3>
		<ol>
			<li>Download and unzip the latest version of Lightbox from above.</li>
			<li>Look inside the <code>js</code> folder to find <code>jquery-1.10.2.min.js</code> and <code>lightbox-2.6.min.js</code> and load both of these files from your html page. Load jQuery first:
<pre><code>&lt;script src=&quot;js/jquery-1.10.2.min.js&quot;&gt;&lt;/script&gt;
&lt;script src=&quot;js/lightbox-2.6.min.js&quot;&gt;&lt;/script&gt;
</code></pre></li>
			<li>Look inside the <code>css</code> folder to find <code>lightbox.css</code> and load it from your html page:
<pre><code>&lt;link href=&quot;css/lightbox.css&quot; rel=&quot;stylesheet&quot; /&gt;
</code></pre>
			</li>
			<li>Look inside the <code>img</code> folder to find <code>close.png</code>, <code>loading.gif</code>, <code>prev.png</code>, and <code>next.png</code>. These files are used in <code>lightbox.css</code>. By default, <code>lightbox.css</code> will look for these images in a folder called <code>img</code>.</li>
		</ol>
		<h3>Part 2 - Turn it on</h3>
	<ul>
			<li>Add a <code>data-lightbox</code> attribute to any image link to activate Lightbox. For the value of the attribute, use a unique name for each image. For example:
<pre><code>&lt;a href=&quot;img/image-1.jpg&quot; data-lightbox=&quot;image-1&quot; title=&quot;My caption&quot;&gt;image #1&lt;/a&gt;
</code></pre>
			 <div class="sub-point"><em>Optional:</em> Set the <code>title</code> attribute if you want to show a caption.</div> </li>
			<li>If you have a group of related images that you would like to combine into a set, use the same <code>data-lightbox</code> attribute value for all of the images. For example:
<pre><code>&lt;a href=&quot;img/image-2.jpg&quot; data-lightbox=&quot;roadtrip&quot;&gt;image #2&lt;/a&gt;
&lt;a href=&quot;img/image-3.jpg&quot; data-lightbox=&quot;roadtrip&quot;&gt;image #3&lt;/a&gt;
&lt;a href=&quot;img/image-4.jpg&quot; data-lightbox=&quot;roadtrip&quot;&gt;image #4&lt;/a&gt;
</code></pre></li>
<li class="last-list-item"><div class="sub-point">For you long time Lightbox users, don't fret, you can still enable Lightbox by using <code>rel="lightbox"</code>. The new <code>data-lightbox</code> approach is preferred though as it is valid html.</div></li>
	</li>
		</ul>
	</section>
</div>
<div style="text-align:center;margin:50px 0; font:normal 14px/24px 'MicroSoft YaHei';">
</div>



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


热门标签: 右键菜单 图片放大镜 缩略图 文字提示框 文字放大缩小 图片放大缩小 图片相册 数字放大缩小 提示框/弹出层 图片墙 layer 百叶窗 lightbox 图片网格 图片九宫格 Tooltip工具提示框 浮动提示框 图片高亮 html5弹窗动画 图片对比 图片文字 单排图片 响应式图片 图片列表 图片拖动 图片放大镜 图片叠加 图片翻转旋转 图片延迟加载 图片淡出淡进 图片全屏 图片头像上传 二维码 图片广告 图片放大缩小 html5图片动画 带缩略图的幻灯片 地图 图片滚动 图片滑动 图片切换 图片收缩展开 旋转木马 图片轮播 自动滚动图片轮播 图标导航菜单 弹出层拖动 背景切换 窗口提示框 手风琴 缩放放大缩小 缩放切换 图表 图片 头像截图

×
×

注册

官方QQ群

扫描上面二维码加微信群

官方QQ群

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

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