本文实例讲述了overlib用法。分享给大家供大家参考,具体如下:
overLIB 是一个生成提示框与弹出菜单等页面效果的一段非常优秀的JS代码。
它可以简单的通过设置一些参数或命令来改变弹出页面的款式、皮肤与形状,不但如此,它还提供了非常简单的扩展功能,来足客户的不同需求。
overLIB 使用非常的简单。
一、在<head></head> 标签内添加:复制代码 代码如下:<script type="text/javascript" src="/UploadFiles/2021-04-02/overlib.js"> 二、在<body></body>标签内添加:复制代码 代码如下:<div id="overDiv" style="position:absolute; visibility:hidden; z-index:1000;"></div> 4.10以上的版本可省略此步
三、生成两种不同款式(popup与sticky)的弹出页面
<a href="javascript:void(0);" onmouseover="return overlib('这是一个popup.');" onmouseout="return nd();">popup示例</a> <a href="javascript:void(0);" onmouseover="return overlib('这是一个sticky',STICKY, MOUSEOFF);" onmouseout="return nd();">stick示例 </a>
四、 命令与参数
popup
Attribute Name
Type
Required
Default
Description
text
string
Yes
n/a
the text/html to display in the popup window
trigger
string
No
onMouseOver
What is used to trigger the popup window. Can be one of onMouseOver or onClick
sticky
boolean
No
false
Makes the popup stick around until closed
caption
string
No
n/a
sets the caption to title
fgcolor
string
No
n/a
color of the inside of the popup box
bgcolor
string
No
n/a
color of the border of the popup box
textcolor
string
No
n/a
sets the color of the text inside the box
capcolor
string
No
n/a
sets color of the box's caption
closecolor
string
No
n/a
sets the color of the close text
textfont
string
No
n/a
sets the font to be used by the main text
captionfont
string
No
n/a
sets the font of the caption
closefont
string
No
n/a
sets the font for the "Close" text
textsize
string
No
n/a
sets the size of the main text's font
captionsize
string
No
n/a
sets the size of the caption's font
closesize
string
No
n/a
sets the size of the "Close" text's font
width
integer
No
n/a
sets the width of the box
height
integer
No
n/a
sets the height of the box
left
boolean
No
false
makes the popups go to the left of the mouse
right
boolean
No
false
makes the popups go to the right of the mouse
center
boolean
No
false
makes the popups go to the center of the mouse
above
boolean
No
false
makes the popups go above the mouse. NOTE: only possible when height has been set
below
boolean
No
false
makes the popups go below the mouse
border
integer
No
n/a
makes the border of the popups thicker or thinner
offsetx
integer
No
n/a
how far away from the pointer the popup will show up, horizontally
offsety
integer
No
n/a
how far away from the pointer the popup will show up, vertically
fgbackground
url to image
No
n/a
defines a picture to use instead of color for the inside of the popup.
bgbackground
url to image
No
n/a
defines a picture to use instead of color for the border of the popup. NOTE: You will want to set bgcolor to "" or the color will show as well. NOTE: When having a Close link, Netscape will re-render the table cells, making things look incorrect
closetext
string
No
n/a
sets the "Close" text to something else
noclose
boolean
No
n/a
does not display the "Close" text on stickies with a caption
status
string
No
n/a
sets the text in the browsers status bar
autostatus
boolean
No
n/a
sets the status bar's text to the popup's text. NOTE: overrides status setting
autostatuscap
string
No
n/a
sets the status bar's text to the caption's text. NOTE: overrides status and autostatus settings
inarray
integer
No
n/a
tells overLib to read text from this index in the ol_text array, located in overlib.js. This parameter can be used instead of text
caparray
integer
No
n/a
tells overLib to read the caption from this index in the ol_caps array
capicon
url
No
n/a
displays the image given before the popup caption
snapx
integer
No
n/a
snaps the popup to an even position in a horizontal grid
snapy
integer
No
n/a
snaps the popup to an even position in a vertical grid
fixx
integer
No
n/a
locks the popups horizontal position Note: overrides all other horizontal placement
fixy
integer
No
n/a
locks the popups vertical position Note: overrides all other vertical placement
background
url
No
n/a
sets image to be used instead of table box background
padx
integer,integer
No
n/a
pads the background image with horizontal whitespace for text placement. Note: this is a two parameter command
pady
integer,integer
No
n/a
pads the background image with vertical whitespace for text placement. Note: this is a two parameter command
fullhtml
boolean
No
n/a
allows you to control the html over a background picture completely. The html code is expected in the "text" attribute
frame
string
No
n/a
controls popups in a different frame. See the overlib page for more info on this function
timeout
string
No
n/a
calls the specified javascript function and takes the return value as the text that should be displayed in the popup window
delay
integer
No
n/a
makes that popup behave like a tooltip. It will popup only after this delay in milliseconds
hauto
boolean
No
n/a
automatically determine if the popup should be to the left or right of the mouse.
vauto
boolean
No
n/a
automatically determine if the popup should be above or below the mouse.
overLIB 可以接受任意个命令和参数。格式如下:命令[,'命令参数']
<a href="javascript:void(0);" onclick="return overlib('This is a sticky with a caption. And it is centered under the mouse!', STICKY, CAPTION, 'Sticky!', CENTER);" onmouseout="nd();">Click here!</a>
五、 overlib的一些使用示例
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <scriptlanguage="JavaScript" src="/UploadFiles/2021-04-02/overlib.js">六、自定义overlib。overlib有三种方式可以实现自定义。
1、我们上面用过的通过输入不同命令来实现自定义。
2、修改overlib.js中的默认值来实现自定义
3、在引用的页面指定变量来实现自定义。overlib点击此处本站下载。
希望本文所述对大家JavaScript程序设计有所帮助。
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
RTX 5090要首发 性能要翻倍!三星展示GDDR7显存
三星在GTC上展示了专为下一代游戏GPU设计的GDDR7内存。
首次推出的GDDR7内存模块密度为16GB,每个模块容量为2GB。其速度预设为32 Gbps(PAM3),但也可以降至28 Gbps,以提高产量和初始阶段的整体性能和成本效益。
据三星表示,GDDR7内存的能效将提高20%,同时工作电压仅为1.1V,低于标准的1.2V。通过采用更新的封装材料和优化的电路设计,使得在高速运行时的发热量降低,GDDR7的热阻比GDDR6降低了70%。
更新日志
- 张敬轩2005《我的梦想我的路》几何娱乐[WAV+CUE][1G]
- 群星《人到四十男儿情(SRS+WIZOR)》[原抓WAV+CUE]
- 马久越《上善若水HQCDII》[低速原抓WAV+CUE]
- 龚玥《女儿情思》6N纯银SQCD【WAV+CUE】
- 张惠妹《你在看我吗》大碟15 金牌大风[WAV+CUE][1G]
- 群星《左耳·听见爱情》星文唱片[WAV+CUE][1G]
- 群星《抖音嗨疯-DISCO英文版》[WAV+CUE][1G]
- 群星.1990-情义无价(TP版)【中唱】【WAV+CUE】
- 马兆骏.1990-心情·七月【滚石】【WAV+CUE】
- 方伊琪.1979-沙鸥(LP版)【星岛全音】【WAV+CUE】
- 蔡琴《醇厚嗓音》6N纯银SQCD【WAV+CUE】
- 陈曦《遇见HQCD》[WAV+CUE]
- 大提琴-刘欣欣《爱的问候》HDCD[WAV+CUE]
- 周耀辉/邓慧中《从什么时候开始》[320K/MP3][95.71MB]
- 周耀辉/邓慧中《从什么时候开始》[FLAC/分轨][361.29MB]