当前位置: 首页 > 图文教程 > 网络编程 > Javascript > JS和CSS实现的气泡窗口

Javascript
form中限制文本字节数js代码
use jscript with List Proxy Server Information
use jscript List Installed Software
List Installed Software Features
List Information About the Binary Files Used by an Application
List the Codec Files on a Computer
List the UTC Time on a Computer
List Installed Hot Fixes
excel操作之Add Data to a Spreadsheet Cell
Add Formatted Data to a Spreadsheet
Apply an AutoFormat to an Excel Spreadsheet
JavaScript语法着色引擎(demo及打包文件下载)
类之Prototype.js学习
一款JavaScript压缩工具:X2JSCompactor
iis6+javascript Add an Extension File
jscript之Open an Excel Spreadsheet
jscript之Read an Excel Spreadsheet
jscript之List Excel Color Values
去除图像或链接黑眼圈的两种方法总结
Add a Formatted Table to a Word Document

Javascript 中的 JS和CSS实现的气泡窗口


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-09-28   浏览: 425 ::
收藏到网摘: n/a

普通的Alt无法自定义风格,而Sweet Titles通过JS脚本与CSS的集合.自定义了这种伪Alt风格.
前一段时间非常流行的,就所谓的气泡窗口(鼠标移到链接处出现的).

我们这里实现的用的是Sweet Titles的插件.显示效果完全由CSS控制..

先下载Sweet Titles的插件(http://www.dustindiaz.com/sweet-titles).
在页面Body处插入如下:
<script type="text/javascript" src="/js/addEvent.js"></script> <!--填入正确的js文件地址-->
<script type="text/javascript" src="/js/sweetTitles.js"></script> <!--填入正确的js文件地址-->


然后在CSS文件里添加如下:
body div#toolTip { position:absolute;
z-index:1000;
width:220px; /*气泡窗口最大宽度.*/
background:#000; /*气泡窗口背景颜色.*/
border:2px double #fff; /*气泡框边缘线粗细,线的类型以及颜色.*/
text-align:left;
padding:5px;
min-height:2em;
-moz-border-radius:5px; /*FireFox专用,用来圆弧划边缘的四角.*/
}

body div#toolTip p {
margin:0;
padding:0;
color:#fff; /*说明文字颜色*/
font:11px/12px verdana,arial,sans-serif;
}

body div#toolTip p em {
display:block;
margin-top:3px;
color:#f60; /*地址文字颜色*/
font-style:normal;
font-weight:bold;
}

body div#toolTip p em span {
font-weight:bold;
color:#fff;
}


注:可以通过修改sweetTitles.js文件里的opacity参数调整气泡框的透明度.默认为80..
this.tip.style.opacity = '.80';
this.tip.style.filter = "alpha(opacity:80)";