• 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", "75%", height:"75%"});
    $("a[rel='example4']").colorbox({slideshow:true});
    $(".example5").colorbox();
    $(".example6").colorbox({iframe:true, innerWidth:425, innerHeight:344});
    $(".example7").colorbox({"80%", height:"80%", iframe:true});
    $(".example8").colorbox({"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就介绍到这里,希望对大家有所帮助。

    原文链接

  • 相关阅读:
    Django——文件上传
    Django——视图基础
    Django——模板基础
    Django——路由基础
    Django——用户认证系统
    Django——form表单
    Django——模型基础(多表)
    Django——模型基础(单表)
    Django博客项目
    黏包
  • 原文地址:https://www.cnblogs.com/sxwgf/p/2230867.html
Copyright © 2020-2023  润新知