日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程资源 > 编程问答 >内容正文

编程问答

jQuery图片播放插件ColorBox使用方法

發布時間:2023/12/18 编程问答 28 豆豆
生活随笔 收集整理的這篇文章主要介紹了 jQuery图片播放插件ColorBox使用方法 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

昨天給大家介紹了一款功能很強大的jquery圖片播放插件Fancybox,今天雖然比較晚了,但筆者依然有沖動要繼續給大家介紹一款好用的jquery圖片播放插件ColorBox,希望對大家平時的Web編程有所幫助。

ColorBox插件的項目主頁地址:http://colorpowered.com/colorbox/

最新版本ColorBox插件下載地址:http://colorpowered.com/colorbox/latest

ColorBox插件演示地址,這里ColorBox提供了5種漂亮的皮膚,大家可以分別去看看各種皮膚的demo

皮膚一演示地址:http://colorpowered.com/colorbox/core/example1/index.html

皮膚二演示地址:http://colorpowered.com/colorbox/core/example2/index.html

皮膚三演示地址:http://colorpowered.com/colorbox/core/example3/index.html

皮膚四演示地址:http://colorpowered.com/colorbox/core/example4/index.html

皮膚五演示地址:http://colorpowered.com/colorbox/core/example5/index.html

這個插件一個最大的特點就是“小”,整個js腳本才10KB,看了上面的演示你可能無法相信如此強大的東西才10KB,但我不得不告訴你,沒錯,它就是這么強悍。

下面就簡單來講講ColorBox的使用方法。

1、引入jquery核心庫和ColorBox腳本文件

<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script src="../colorbox/jquery.colorbox.js"></script>

2、引入ColorBox樣式表文件,注意引入不同皮膚的css文件將實現不同的皮膚

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

3、html代碼

<h2>彈性效果</h2>
<p><a href="../content/ohoopee1.jpg" rel="example1" title="Me and my grandfather on the Ohoopee.">Grouped Photo 1</a></p>
<p><a href="../content/ohoopee2.jpg" rel="example1" title="On the Ohoopee as a child">Grouped Photo 2</a></p>
<p><a href="../content/ohoopee3.jpg" rel="example1" title="On the Ohoopee as an adult">Grouped Photo 3</a></p>

<h2>淡入淡出效果</h2>
<p><a href="../content/ohoopee1.jpg" rel="example2" title="Me and my grandfather on the Ohoopee">Grouped Photo 1</a></p>
<p><a href="../content/ohoopee2.jpg" rel="example2" title="On the Ohoopee as a child">Grouped Photo 2</a></p>
<p><a href="../content/ohoopee3.jpg" rel="example2" title="On the Ohoopee as an adult">Grouped Photo 3</a></p>

<h2>沒有動畫效果,高度固定(屏幕大小的75%)</h2>
<p><a href="../content/ohoopee1.jpg" rel="example3" title="Me and my grandfather on the Ohoopee.">Grouped Photo 1</a></p>
<p><a href="../content/ohoopee2.jpg" rel="example3" title="On the Ohoopee as a child">Grouped Photo 2</a></p>
<p><a href="../content/ohoopee3.jpg" rel="example3" title="On the Ohoopee as an adult">Grouped Photo 3</a></p>

<h2>自動播放</h2>
<p><a href="../content/ohoopee1.jpg" rel="example4" title="Me and my grandfather on the Ohoopee.">Grouped Photo 1</a></p>
<p><a href="../content/ohoopee2.jpg" rel="example4" title="On the Ohoopee as a child">Grouped Photo 2</a></p>
<p><a href="../content/ohoopee3.jpg" rel="example4" title="On the Ohoopee as an adult">Grouped Photo 3</a></p>

4、jquery初始化代碼

$(document).ready(function(){
//Examples of how to assign the ColorBox event to elements
$("a[rel='example1']").colorbox();
$("a[rel='example2']").colorbox({transition:"fade"});
$("a[rel='example3']").colorbox({transition:"none", width:"75%", height:"75%"});
$("a[rel='example4']").colorbox({slideshow:true});
$(".example5").colorbox();
$(".example6").colorbox({iframe:true, innerWidth:425, innerHeight:344});
$(".example7").colorbox({width:"80%", height:"80%", iframe:true});
$(".example8").colorbox({width:"50%", inline:true, href:"#inline_example1"});
$(".example9").colorbox({
onOpen:function(){ alert('onOpen: colorbox is about to open'); },
onLoad:function(){ alert('onLoad: colorbox has started to load the targeted content'); },
onComplete:function(){ alert('onComplete: colorbox has displayed the loaded content'); },
onCleanup:function(){ alert('onCleanup: colorbox has begun the close process'); },
onClosed:function(){ alert('onClosed: colorbox has completely closed'); }
});
});

OK,ColorBox就介紹到這里,希望對大家有所幫助。

原文鏈接

轉載于:https://www.cnblogs.com/sxwgf/archive/2011/10/31/2230867.html

總結

以上是生活随笔為你收集整理的jQuery图片播放插件ColorBox使用方法的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。