首页 > 代码库 > jQuery渐变弹出层

jQuery渐变弹出层

css:

[css]#race{display:block;width:200px;height:50px;line-height:50px;text-align:center;background:#CCC;border:#555 1px solid;}.raceShow{border:solid 1px #ccc;position:absolute;display:none;width:300px;height:100px;padding:5px;font-size:12px;}[/css]

js:

[javascript]$(document).ready(function(){var speed = 600;//动画速度$(“#race a”).click(function(event){//绑定事件处理event.stopPropagation();var offset = $(event.target).offset();//取消事件冒泡$(“#racePop”).css({ top:offset.top + $(event.target).height() + “px”, left:offset.left });//设置弹出层位置$(“#racePop”).show(speed);//动画显示});$(document).click(function(event) { $(“#racePop”).hide(speed) });//单击空白区域隐藏$(“#racePop”).click(function(event) { $(“#racePop”).hide(speed) });//单击弹出层则自身隐藏});[/javascript]