技术库 技术手册 字体库 知识点 词汇表 联系我们
内容搜索   
本站最新推出网站制作字体库。
当前位置:WEB技术知识资源库(www.cn-web.com) .: WEB技术相关 .: JavaScript .: overLIB的用法与示例(提示框与弹出菜单)

overLIB的用法与示例(提示框与弹出菜单)

overLIB 是一个生成提示框与弹出菜单等页面效果的一段非常优秀的JS代码。
它可以简单的通过设置一些参数或命令来改变弹出页面的款式、皮肤与形状,不但如此,它还提供了非常简单的扩展功能,来足客户的不同需求。

 overLIB 使用非常的简单。
 一、在<head></head> 标签内添加: <script type="text/javascript" src="overlib.js"><!-- overLIB (c) Erik Bosrup --></script>

 二、在<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>
 四、 命令与参数
  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">
<script language="JavaScript" src="overlib.js"></script><html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body>
<href="#" onclick="return overlib('使用overlib的命令', CAPTION, '这是Caption命令,就是生成头部',HAUTO);""  onmouseout="return nd();" >弹出测试</a> 
<href="javascript:void(0);" onmouseover="return overlib('This is an ordinary  popup.',CLOSECLICK);" onmouseout="return nd();">here</a> 
<href="javascript:void(0);" onmouseover="return overlib('This is what  we call a sticky, since I stick around (it goes away if you move the mouse  OVER and then OFF the overLIB popup--or mouseover another overLIB).',  STICKY, MOUSEOFF);" onmouseout="return nd();">吸附性的提示框</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);">含CAPTION的STICKY!</a> 
<href="javascript:void(0);" onclick="return overlib('Setting size and posiztion!', STICKY, CAPTION,'Sticky!',HEIGHT, 100,WIDTH,120,LEFT);">指定大小与位置弹出</a> 
<href="javascript:void(0);" onclick="return overlib('Setting size and posiztion!', STICKY, CAPTION,'Sticky!',STATUS ,'Hello');">设置状态栏</a> 
</body>
</html>

 

 六、自定义overlib。overlib有三种方式可以实现自定义。
  1、我们上面用过的通过输入不同命令来实现自定义。
  2、修改overlib.js中的默认值来实现自定义
  3、在引用的页面指定变量来实现自定义。

下载 http://www.bosrup.com/web/overlib/?Download
更多使用请参考
 http://www.bosrup.com/web/overlib/?Homepage 


对此文章打分评级

用户评论

增加评论
此文章还没有任何评论!
网站地图 - 知识词汇 - 全文检索 - 广告服务 - 帮助中心 - 联系我们
.:www.cn-web.com
网站技术开发联盟之WEB开发技术知识库
联系人:老韩(QQ:5679551)
晋ICP备07003487号