jquery圖片播放瀏覽插件prettyPhoto使用詳解
一、prettyPhoto簡介

prettyPhoto是一款基于jquery的輕量級的lightbox圖片播放瀏覽插件,它不僅支持圖片,還同時支持視頻、flash、YouTube、iframe和ajax。而且prettyPhoto配置和使用都十分簡單,擴展性也不錯,你可以最大限度地自定義prettyPhoto。目前,prettyPhoto兼容大部分主流的瀏覽器,包括令人糾結的IE6。
prettyPhoto插件的項目地址:http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/
建議英文好的朋友直接去官網上了解這個插件的用法,如果你的英文很爛,那么也別急,下面我就給大家來一一介紹prettyPhoto的使用方法。
二、prettyPhoto使用方法介紹
1、引入jquery核心庫和prettyPhoto插件庫以及prettyPhoto樣式表文件
<script src="js/jquery.js" type="text/javascript" charset="utf-8"></script>
<link rel="stylesheet" href="css/prettyPhoto.css" type="text/css" media="screen" charset="utf-8" />
<script src="js/jquery.prettyPhoto.js" type="text/javascript" charset="utf-8"></script>
2、初始化jquery插件,以下是最簡單的配置的js代碼
$(document).ready(function(){
$("a[rel^='prettyPhoto']").prettyPhoto();
});
下面是每種類型的html代碼
1、單張圖片
<a href="images/fullscreen/2.jpg" rel="prettyPhoto" title="This is the description">
<img src="images/thumbnails/t_2.jpg" width="60" height="60" alt="This is the title" />
</a>
2、圖片相冊
<a href="images/fullscreen/1.jpg" rel="prettyPhoto[pp_gal]" title="You can add caption to pictures.">
<img src="images/thumbnails/t_1.jpg" width="60" height="60" alt="Red round shape" />
</a>
<a href="images/fullscreen/2.jpg" rel="prettyPhoto[pp_gal]">
<img src="images/thumbnails/t_2.jpg" width="60" height="60" alt="Nice building" />
</a>
<a href="images/fullscreen/3.jpg" rel="prettyPhoto[pp_gal]">
<img src="images/thumbnails/t_3.jpg" width="60" height="60" alt="Fire!" />
</a>
<a href="images/fullscreen/4.jpg" rel="prettyPhoto[pp_gal]">
<img src="images/thumbnails/t_4.jpg" width="60" height="60" alt="Rock climbing" />
</a>
<a href="images/fullscreen/5.jpg" rel="prettyPhoto[pp_gal]">
<img src="images/thumbnails/t_5.jpg" width="60" height="60" alt="Fly kite, fly!" />
</a>
3、單個flash
<a href=" rel="prettyPhoto[flash]" title="Flash 10 demo">
<img src="images/thumbnails/flash-logo.jpg" alt="Flash 10 demo" width="60" />
</a>
4、YouTube視頻
5、Vimeo
6、QuickTime影片
7、外部網站(iframe)
<a href=" rel="prettyPhoto[iframes]" title="Google.com opened at 100%">Google.com</a>
<a href=" <a href="
8、普通文本
<a href="#inline-1" rel="prettyPhoto" ><img src="/wp-content/themes/NMFE/images/thumbnails/earth-logo.jpg" alt="" width="50" /></a>
<div id="inline-1" class="hide">
<p>這里是普通的文本</p>
<p>今天給大家介紹的prettyPhoto希望大家能喜歡,這個是播放普通文本的html</p>
</div>
9、AJAX內容
<a rel="prettyPhoto[ajax]" href="/demos/prettyPhoto-jquery-lightbox-clone/xhr_response.html?
ajax=true&width=325&height=185">Ajax content</a>
三、總結
prettyBox圖片播放插件很好用,趕緊用它來打造你的專屬相冊吧!
相關文章
jQuery Form插件使用詳解_動力節(jié)點Java學院整理
這篇文章主要為大家詳細介紹了jQuery Form插件的使用方法,具有一定的參考價值,感興趣的小伙伴們可以參考一下2017-07-07
jquery form表單提交插件asp.net后臺中文解碼
對于jquery form表單提交插件jquery.form.js,在提交表單數據時,如果表單數據有中文,則被提交的數據是要經過編碼的。2010-06-06
jQuery Attributes(屬性)的使用(一、屬性篇)
本系列文章主要講述jQuery框架的屬性(Attributes)使用方法,文章分為:屬性篇、類篇、Html代碼篇&文本篇、值篇共4篇文章。2009-12-12

