prettyPhoto是一款基于jquery的轻量级的lightbox图片特效脚本,它不仅支持图片,还同时支持视频、flash、 YouTube、iframe和ajax。而且prettyPhoto配置和使用都十分简单,扩展性也不错,你可以最大限度地自定义 prettyPhoto。prettyPhoto兼容大部分主流的浏览器,有些Wordpress图片插件就是基于此脚本制作的。

比如:Wordpress插件:Royal PrettyPhoto

建议英文好的朋友直接去官网上了解这个插件的用法,如果你的英文很烂,那么也别急,下面我就给大家来一一介绍prettyPhoto的使用方法。

http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/

一、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代码

  1. $(document).ready(function(){
  2. $("a[rel^='prettyPhoto']").prettyPhoto();
  3. });

下面是每种类型的html代码

1、单张图片

  1. <a href="images/fullscreen/2.jpg"rel="prettyPhoto"title="This is the description">
  2. <img src="images/thumbnails/t_2.jpg"width="60"height="60"alt="This is the title"/>
  3. </a>

2、图片相册

  1. <a href="images/fullscreen/1.jpg"rel="prettyPhoto[pp_gal]"title="You can add caption to pictures.">
  2. <img src="images/thumbnails/t_1.jpg"width="60"height="60"alt="Red round shape"/>
  3. </a>
  4. <a href="images/fullscreen/2.jpg"rel="prettyPhoto[pp_gal]">
  5. <img src="images/thumbnails/t_2.jpg"width="60"height="60"alt="Nice building"/>
  6. </a>
  7. <a href="images/fullscreen/3.jpg"rel="prettyPhoto[pp_gal]">
  8. <img src="images/thumbnails/t_3.jpg"width="60"height="60"alt="Fire!"/>
  9. </a>
  10. <a href="images/fullscreen/4.jpg"rel="prettyPhoto[pp_gal]">
  11. <img src="images/thumbnails/t_4.jpg"width="60"height="60"alt="Rock climbing"/>
  12. </a>
  13. <a href="images/fullscreen/5.jpg"rel="prettyPhoto[pp_gal]">
  14. <img src="images/thumbnails/t_5.jpg"width="60"height="60"alt="Fly kite, fly!"/>
  15. </a>

3、单个flash

  1. <a href="http://www.adobe.com/products/flashplayer/include/marquee/design.swf?width=792&amp;height=294"
  2. rel="prettyPhoto[flash]"title="Flash 10 demo">
  3. <img src="images/thumbnails/flash-logo.jpg"alt="Flash 10 demo"width="60"/>
  4. </a>

4、YouTube视频

  1. <a href="http://www.youtube.com/watch?v=qqXi8WmQ_WM"rel="prettyPhoto"title="">
  2. <img src="images/thumbnails/flash-logo.jpg"alt="YouTube"width="60"/>
  3. </a>

5、Vimeo

  1. <a href="http://vimeo.com/8245346"rel="prettyPhoto"title="">
  2. <img src="images/thumbnails/flash-logo.jpg"alt="YouTube"width="60"/>
  3. </a>

6、QuickTime影片

  1. <a title="Despicable Me"rel="prettyPhoto[movies]"
  2. href="http://trailers.apple.com/movies/universal/despicableme/despicableme-tlr1_r640s.mov?width=640&height=360">
  3. <img src="/wp-content/themes/NMFE/images/thumbnails/quicktime-logo.png"alt="Despicable Me"width="50"/>
  4. </a>
  5. <a title="Tales from Earthsea"rel="prettyPhoto[movies]"
  6. href="http://trailers.apple.com/movies/disney/talesfromearthsea/talesfromearthsea-tlr1_r640s.mov?width=640&height=340">
  7. <img src="/wp-content/themes/NMFE/images/thumbnails/quicktime-logo.png"alt="Tales from Earthsea"width="50"/>
  8. </a>
  9. <a title="Grease Sing-A-Long"rel="prettyPhoto[movies]"
  10. href="http://trailers.apple.com/movies/paramount/greasesingalong/greasesingalong-tlr1_r640s.mov?width=640&height=272">
  11. <img src="/wp-content/themes/NMFE/images/thumbnails/quicktime-logo.png"alt="Grease Sing-A-Long"width="50"/>
  12. </a>

7、外部网站(iframe)

  1. <a href="http://www.google.com?iframe=true&width=100%&height=100%"
  2. rel="prettyPhoto[iframes]"title="Google.com opened at 100%">Google.com</a>
  3. <a href="http://www.apple.com?iframe=true&width=500&height=250"rel="prettyPhoto[iframes]">Apple.com</a>
  4. <a href="http://www.twitter.com?iframe=true&width=400&height=200"rel="prettyPhoto[iframes]">Twitter.com</a>

8、普通文本

  1. <a href="#inline-1"rel="prettyPhoto"><img src="/wp-content/themes/NMFE/images/thumbnails/earth-logo.jpg"alt=""width="50"/></a>
  2. <div id="inline-1"class="hide">
  3. <p>这里是普通的文本</p>
  4. <p>今天给大家介绍的prettyPhoto希望大家能喜欢,这个是播放普通文本的html</p>
  5. </div>

9、AJAX内容

  1. <a rel="prettyPhoto[ajax]"href="/demos/prettyPhoto-jquery-lightbox-clone/xhr_response.html?
  2. ajax=true&width=325&height=185">Ajax content</a>

jQuery图片特效脚本prettyPhoto简介相关推荐

  1. 精心挑选的23款美轮美奂的 jQuery 图片特效插件

    jQuery是一个非常优秀的 JavaScript 框架,使用简单灵活,同时还有许多成熟的插件可供选择.其中,jQuery 最令人印象深刻的应用之一就是对图片的处理,它可以让帮助你在你的项目中加入各种 ...

  2. Jquery图片特效

    有左右按键交互展示效果,特别突出之处是产品图片有阴影效果,内似flash,是产品展示的首先特效,能增强网站的品味及产品的时间 又一个围剿Flash jQuery图片特效,运动比较流畅流畅,有左右按键交 ...

  3. jQuery图片播放插件prettyPhoto使用介绍

    演示效果  http://www.17sucai.com/preview/131993/2014-07-09/mac-Bootstrap/gallery.html 点击之后的效果 使用方法 Query ...

  4. 精心挑选的15款优秀 jQuery 文本特效插件和教程

    今天这篇文章向大家分享15款精心挑选的优秀 jQuery 文本特效插件,都带有详细的使用教程.jQuery 是最流行和使用最广泛的 JavaScript 框架,它简化了 HTML 文档遍历,事件处理, ...

  5. 7个不容错过的jQuery图片动画及源码

    jQuery处理图片的例子特别多,因为图片动画特效可以让网页更加生动,当然,随着CSS3的的加入,jQuery在处理图片方面更为优秀,出来的效果也更加迷人.本文要分享一些基于jQuery的图片动画效果 ...

  6. html5图片动画源码,不容错过的jQuery图片动画及源码

    本文作者html5tricks,转载请注明出处 jQuery处理图片的例子特别多,因为图片动画特效可以让网页更加生动,当然,随着CSS3的的加入,jQuery在处理图片方面更为优秀,出来的效果也更加迷 ...

  7. 可进可退,jQuery图片、视频、flash播放插件prettyPhoto使用记录

    一.prettyPhoto简介 prettyPhoto是一款基于jquery的轻量级的lightbox图片播放浏览插件,它不仅支持图片,还同时支持视频.flash.YouTube.iframe和aja ...

  8. jQuery图片翻转弹出动画特效

    详细内容请点击 今天我们要来分享一款效果很酷的jQuery图片弹出动画,该动画一共有6组,除了第一组普通弹出外,其他图片弹出的时候均会出现各种不同的翻转动画效果,另外有几组的图片时旋转弹出的,效果也非 ...

  9. 分享8款简单大气的jQuery/CSS3图片特效

    自从jQuery问世以后,网页上就流行很多漂亮的图片效果,像淡入淡出或者焦点图等,但是,现在jQuery结合CSS3,我们可以打造更美观更实用的图片特效.下面分享8款简单而又大气的jQuery/CSS ...

  10. jQuery图片自动轮转动画特效

    本例的功能是用jQuery图片自动轮转动画特效实现阿里巴巴首页图片动画效果. 所用到的图片截图: 从网上下载一个jQuery文件jquery.js: 具体HTML网页代码如下: <!DOCTYP ...

最新文章

  1. X-Content-Type-Options: nosniff
  2. java 折线图_java折线图的数据写入方法
  3. a*算法流程图_学好流程控制结构轻松应对高考数学程序算法题
  4. mysql LOCK TABLES
  5. Ionic 框架宣布 2019 年将正式支持 Vue 和 React
  6. cocos2dx游戏开发简单入门视频教程 (cocos2d-x)-第2天
  7. linux gulp安装教程,Linux环境NodeJS安装及Gulp安装
  8. 装饰器模式在 Collections 类中的应用
  9. 【Hoxton.SR1版本】Spring Cloud Gateway网关初体验
  10. 锁存器,触发器,寄存器关系及区别
  11. Excel绘制CDF图
  12. 全球地名中英文对照表(M)
  13. 在SSH会话中如何实现 X11 Forwarding
  14. 手机USSD网络命令编辑器
  15. 标准盒模型与怪异盒模型
  16. 纯CSS3实现常见多种相册效果
  17. Java面试——多线程高并发
  18. linux运维笔记:动态网页资源
  19. 毕业设计 基于大数据的旅游数据分析与可视化系统
  20. 百度灵医智惠渗透基层,以AI赋能中国医疗

热门文章

  1. CH340g的使用说明
  2. android 源代码 毛笔,android中实现毛笔效果(View 中绘图)
  3. 【创作中心】自定义模板的使用
  4. react中引入swiper详细教程 亲测没测出来
  5. x86 单线并发多拨_OpenWrt ADSL单线多拨,负载均衡(仅供参考)
  6. 数学函数模块math
  7. 未来计算机的将朝着,未来计算机将朝着哪几个方向发展?
  8. 魔兽延迟最低的服务器,魔兽世界延迟高怎么回事_魔兽世界延迟高解决方法_玩游戏网...
  9. hp proliant DL360p Gen8风扇故障排除
  10. Java实现UDP组播(multicast)和单播(unicast)简单例子——局域网内