ThickBox 3.1参数详细解释
方砚
2023-12-01
ThickBox 3.1参数详细解释
class="thickbox" 调用特效;
height 打开页面的高度;
width 打开页面的宽度;
title="Iframe(Auto Hide)" title的内容;
keepThis=true TB_iframe=true 这两个参数没搞明白什么意思,但通过框架来调用页面时不可缺少;
#TB_inline 调用当前页面的层;
inlineId 当前页面层的ID;
modal=true 表示禁用title,去掉即可显示title及可自动关闭;
1、调用框架,固定宽度和高度,超出显示滚动条 Iframe(auto hide):
<a href="http://www.cookseo.com?keepThis=true&TB_iframe=true&height=500&width=820" title="ThickBox 3.1:调用框架,固定宽度和高度,超出显示滚动条" class="thickbox">OECSPACE</a>
2、打开页面,固定宽度和高度,无滚动条,禁用title, fixed width, fixed height
<a href="boxs.html?keepThis=true&TB_iframe=true&height=100&width=220&modal=true" title="ThickBox 3.1:modal=true表示禁用title,去掉即可显示title及可自动关闭" class="thickbox">Open iFrame Modal</a>
3、Ajax载入,自动宽度和高度,禁用title,页面无法查看源代码
<a href="box.html?height=350&width=350&modal=true" title="ThickBox 3.1:Ajax载入,页面无法查看源代码" class="thickbox">Example</a>
4、链接显示隐藏的层,层存在于页面中。
<a href="#TB_inline?height=200&width=300&inlineId=hiddenModalContent&modal=true" title="ThickBox 3.1:链接显示隐藏层" class="thickbox">Show hidden modal content</a>
<div id="hiddenModalContent" style="display:none">
<p>ThickBox hidden modal content. Click to hide.</p>
<p style="text-align:center"><input type="submit" value=" O K " οnclick="tb_remove()" /></p>
</div>
5、按钮显示隐藏的层,层存在于页面中。
<input alt="#TB_inline?height=150&width=400&inlineId=myOnPageContent " title="ThickBox 3.1:按钮显示隐藏层" class="thickbox" type="button" value="Show" />
<div id="myOnPageContent" style="display:none">
<p>ThickBox hidden modal content.Auto Hide.</p>
</div>
6、单张图片调用
<a href="images/plant1.jpg" title="plant" class="thickbox"><img src="images/plant1_t.jpg" alt="ThickBox 3.1" /></a>
7、多张图片调用
<a href="images/plant1.jpg" title="plant1" class="thickbox" rel="gallery-plants"><img src="images/plant1_t.jpg" alt="ThickBox 3.1 1" /></a>
<a href="images/plant2.jpg" title="plant2" class="thickbox" rel="gallery-plants"><img src="images/plant2_t.jpg" alt="ThickBox 3.1 2" /></a>
<a href="images/plant3.jpg" title="plant3" class="thickbox" rel="gallery-plants"><img src="images/plant3_t.jpg" alt="ThickBox 3.1 3" /></a>
另外,如果不想点击图片关闭的话,找到thickbox.js,到128行,把下面的代码:
$("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a> or Esc Key</div>");
改成:
$("#TB_window").append("<img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'>close</a> or Esc Key</div>");
即可