jQuery ColorBox参数

2019-07-10 浏览:1945
jQuery ColorBox参数
评论:(0)复制地址

jQuery ColorBox调用方法,必须调用jQuery


<script type="text/javascript">

    $(document).ready(function(){

        $(".detail-desc").colorbox({

            inline:true,

            opacity: 0.6,

            width: "90%"

        });

    });

</script>


范例:


<a class="link detail-desc" href="#detail-intro">详细剧情</a>
<div style="display:none">
    <div id="detail-intro">
        <div class="ui-dialog-cnt">
            <div class="detail-desc-cnt">
                [!--moviesay--]
            </div>
        </div>
    </div>
</div>
<script type="text/javascript">
    $(document).ready(function(){
        $(".detail-desc").colorbox({
            inline:true,
            opacity: 0.6,
            width: "90%"
        });
    });
</script>


ColorBox常用属性:


设置的值

 默认值

 介绍

transition

"elastic"

过渡效果,可以是"elastic", "fade", or "none".

speed

350

设置过渡效果的持续时间,毫秒

hreffalse

Example:$('h1').colorbox({href:"welcome.html"})

这个用来设置一个锚标记的值或者一个不是锚的元素,例如图像或者表单的按钮,例如:

titlefalse

这可以为Colorbox设置一个标题

relfalse

Example:$('#example a').colorbox({rel:'group1'})

这个可以根据元素的rel属性设置要显示的元素集合,也可以覆盖一个存在的rel属性

widthfalse

Example: "100%", "500px", or 500

设置宽度,包括边框和按钮

heightfalse

 Example: "100%", "500px", or 500

设置高度,包括边框和按钮

innerWidthfalse

Example: "50%", "500px", or 500

这个可以设定一个固定的内大小,包括边框和按钮

innerHeightfalse

Example: "50%", "500px", or 500

这个可以设定一个固定的内高度,包括边框和按钮

initialWidth300

设置初始化宽度

initialHeight100

设置初始化高度

maxWidthfalse

 Example: "100%", 500, "500px"

设置内容的最大宽度

maxHeightfalse

Example: "100%", 500, "500px"

设置内容的最大高度

scalePhotostrue

如果是true且maxWidth, maxHeight, innerWidth, innerHeight, width, 或者 height 被设置,

Colorbox会缩放图片以使用边框

scrollingtrue

如果是false,Colorbox不会为了溢出元素设置滚动条

iframefalse

如果是true,元素会在Iframe中显示

inlinefalse

Example: $("#inline").colorbox({inline:true, href:"#myForm"});

如果是true,jQuery选择器可以用来选择要显示的元素。例如:

htmlfalse

Example: 
$.fn.colorbox({html:'

Hello

'});

这个是直接让你显示HTML代码,例

photofalse

如果为true,ColorBox只会把元素按照图片显示,防止类似photo.php?pic=1这样的连接被误认为是网页

opacity0.85

遮罩层不透明度 从0-1之间取值

openfalse

如果为true,ColorBox会自动开启

preloadingtrue

如果为True,ColorBox会自动预载要显示图片

overlayClosetrue

为true单击遮罩层就可以把ColorBox关闭

slideshowfalse

为True,会自动滚动图片

slideshowSpeed2500

设置时间,毫秒

slideshowAutotrue

为tuue,滑动会自动开始

slideshowStart"start slideshow"

开始自动滑动按钮的文本

slideshowStop"stop slideshow"

停止自动滑动按钮的文本

current"{current} of {total}"

文本内容:现在正在显示的元素序号

previous"previous"

“上一个”按钮的文本

next"next"

“下一个”按钮的文本

close"close"

“关闭”按钮的文本


评论:(0)复制地址
发布:苗景云 | 分类:IT技术&设计 | Tags:jQuery ColorBox

发表评论:

◎欢迎参与讨论,请在这里发表您的看法、交流您的观点。