-
$(".inline").colorbox({inline:true, width:"50%"});
<p><a class='inline' href="#inline_content">Inline HTML</a></p>
<div style='display:none'>
<div id='inline_content' style='padding:10px; background:#fff;'>
<p><strong>This content comes from a hidden element on this page.</strong></p>
<p>The inline option preserves bound JavaScript events and changes, and it puts the content back where it came from when it is closed.</p>
</div>
</div>
在上面的代码中,每种使用方式都有说明,从代码中可以看出, colorbox 使用起来是非常的简单。
colorbox 还提供了很多的属性、方法和事件,可以让我们更加方式的就用 colorbox,下面是一个从网上找的一个中文的参考列表:
KEY
设置的值
DEFAULT
默认值
DESCRIPTION
介绍
transition
“elastic”
The transition type. Can be set to “elastic”, “fade”, or “none”.
过渡效果,可以是”elastic”, “fade”, or “none”.
speed
350
Sets the speed of the fade and elastic transitions, in milliseconds.
设置过渡效果的持续时间,毫秒
href
false
This can be used as an alternative anchor URL or to associate a URL for non-anchor elements such as images or form buttons. Example:
$(‘h1′).colorbox({href:”welcome.html”})
这个用来设置一个锚标记的值或者一个不是锚的元素,例如图像或者表单的按钮,例如:
title
false
This can be used as an anchor title alternative for ColorBox.
这可以为Colorbox设置一个标题
rel
false
This can be used as an anchor rel alternative for ColorBox. This allows the user to group any combination of elements together for a gallery, or to override an existing rel so elements are not grouped together. Example:
$(‘#example a’).colorbox({rel:’group1′})
这个可以根据元素的rel属性设置要显示的元素集合,也可以覆盖一个存在的rel属性
width
false
Set a fixed total width. This includes borders and buttons. Example: “100%”, “500px”, or 500
设置宽度,包括边框和按钮
height
false
Set a fixed total height. This includes borders and buttons. Example: “100%”, “500px”, or 500
设置高度,包括边框和按钮
innerWidth
false
This is an alternative to ‘width’ used to set a fixed inner width. This excludes borders and buttons. Example: “50%”, “500px”, or 500
这个可以设定一个固定的内大小,包括边框和按钮
innerHeight
false
This is an alternative to ‘height’ used to set a fixed inner height. This excludes borders and buttons. Example: “50%”, “500px”, or 500
这个可以设定一个固定的内高度,包括边框和按钮
initialWidth
300
Set the initial width, prior to any content being loaded.
设置初始化宽度
initialHeight
100
Set the initial height, prior to any content being loaded.
设置初始化高度
maxWidth
false
Set a maximum width for loaded content. Example: “100%”, 500, “500px”
设置内容的最大宽度
maxHeight
false
Set a maximum height for loaded content. Example: “100%”, 500, “500px”
设置内容的最大高度
scalePhotos
true
If ‘true’ and if maxWidth, maxHeight, innerWidth, innerHeight, width, or height have been defined, ColorBox will scale photos to fit within the those values.
如果是true且maxWidth, maxHeight, in
colorbox 弹出层 jquery
最新推荐文章于 2019-09-30 23:51:16 发布