一 、prettyPhoto简介

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

目前,prettyPhoto兼容大部分主流的浏览器,包括令人纠结的IE6。

prettyPhoto插件的项目地址:http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/

二、组件引用

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();
});

三、prettyPhoto使用方法介绍

1、单张图片

<a href="images/fullscreen/2.jpg" rel="prettyPhoto" title="This is the description">
<img src="data: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="data: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="data: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="data:images/thumbnails/t_3.jpg" width="60" height="60" alt="Fire!" />
</a>
<a href="images/fullscreen/4.jpg" rel="prettyPhoto[pp_gal]"><img src="data: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="data:images/thumbnails/t_5.jpg" width="60" height="60" alt="Fly kite, fly!" />
</a>

3、单个flash

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

4、YouTube视频

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

5、Vimeo

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

6、QuickTime影片

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

7、外部网站(iframe)

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

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>

【JQ组件】prettyPhoto使用介绍相关推荐

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

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

  2. 小程序 video 控制器外观调整_「小程序JAVA实战」小程序视频组件与api介绍(51)...

    这次说下,小程序的视频组件,之前在说小程序基础的时候视频组件没说,现在说下.从属性和api都说下.https://github.com/limingios/wxProgram.git 中No.15 视 ...

  3. DNS术语,组件和概念介绍

    DNS术语,组件和概念介绍 2014年2月18日发布 255.4k个意见 DNS 概念LINUX基础常见问题 介绍 DNS或域名系统往往是学习如何配置网站和服务器的一个非常困难的部分.了解DNS如何工 ...

  4. 【微服务架构】SpringCloud组件和概念介绍

    [微服务架构]SpringCloud组件和概念介绍(一) 一:什么是微服务(Microservice)微服务英文名称Microservice,Microservice架构模式就是将整个Web应用组织为 ...

  5. 阿里云大数据组件的基本介绍

    阿里云大数据组件的基本介绍 注意:本文结合了本人对Hadoop生态和Spark的理解,阅读本文需要对传统的大数据组件有基本的认识和了解.本文不具备权威性,若要准确地了解阿里云大数据组件的特性请直接查看 ...

  6. MMKV数据存储组件的使用介绍

    MMKV数据存储组件的使用介绍 . 介绍 MMKV 是微信开源的基于 mmap 内存映射的 key-value 组件,底层序列化/反序列化使用 protobuf 实现,性能高,稳定性强.已移植到 An ...

  7. 日志组件Log2Net的介绍和使用(附源码开源地址)

    Log2Net是一个用于收集日志到数据库或文件的组件,支持.NET和.NetCore平台. 此组件自动收集系统的运行日志(服务器运行情况.在线人数等).异常日志.程序员还可以添加自定义日志. 该组件支 ...

  8. 地图可视化组件–folium简单介绍

    地图可视化组件–folium简单介绍 folium是基于Python环境开发的一个地图绘制包,可以在程序中引入从而绘制精美的地图数据可视化图表.folium建立在Python生态系统的数据处理能力和L ...

  9. SharePoint 2016 必备组件离线安装介绍

    前言 SharePoint 必备组件安装,一直以来都是SharePoint安装过程中的最大的坑,尤其是不能联网的服务器.博主在这里简单介绍一下离线安装过程,并附组件包下载以及安装命令,并且在windo ...

最新文章

  1. 服务器市场步步为营:Intel发布新款至强Xeon E5-4600v4四路处理器
  2. 蓝桥杯练习系统习题-历年真题解析1(完整版)
  3. [转]侯捷对进入IT行业的年轻人的建议
  4. upc组队赛5 Bulbs
  5. 如何将四元数方向转化为旋转举证_是否有将四元数旋转转换为欧拉角旋转的算法?...
  6. linux目录规范及简单说明
  7. Spring Boot返回的数据格式是XML 而不是JSON之原因探求的和解决
  8. 计算机博弈的代码java,Java 速成
  9. Keil5 程序下载到RAM中并运行,
  10. java线性表的实验心得_线性表实验心得.docx
  11. [window] win7系统下电脑声音正常,右下角的小喇叭图标不见了
  12. ipad html 自定义裁剪图片大小,如何在iPhone或iPad上裁剪和编辑照片 | MOS86
  13. 你身边长期不上班的人,靠什么活着?
  14. thinkpad e450c蓝牙重新安装后不能搜索到手机解决方案--适用大部分笔记本
  15. 使用python的turtle库画表情包
  16. C语言rewind函数返回值为空,C语言rewind和fseek函数的用法详解(随机读写文件)...
  17. 二台电脑之间数据库文件进行备份
  18. 信息平台课件服务器,《CDN平台介绍v》PPT课件.ppt
  19. 【Machine Learning 学习笔记】Stochastic Dual Coordinate Ascent for SVM 代码实现
  20. DNSPod十问云开发宁鹏伟:重新定义开发

热门文章

  1. Wintun:一款惊艳的 WireGuard 虚拟网卡接口驱动
  2. 熔岩羊驼LLaVA:社区又一个多模态大模型,像GPT-4一样可以看图聊天
  3. LiDAR三维激光扫描与大数据
  4. JS生成带Logo的QRCode二维码
  5. 安科瑞ANet通信管理机在电力监控系统中的应用
  6. 华为服务器安装系统kvm,华为服务器 重装系统
  7. 软件测试常见的经典面试题
  8. 三菱FX3U 485BD与3台施耐德ATV 71变频器通讯程序
  9. 死磕 Elasticsearch 方法论:普通程序员高效精进的 10 大狠招!
  10. 九章算法人工智能集训营