var id = that.attr(“id”);
var div = $(“#tm”);
div.css(“position”, “absolute”);//让这个层可以绝对定位
that.hoverDelay( {
outDuring :1000,
hoverEvent : function() {
div.css(“display”, “block”);
var p = that.position(); //获取这个元素的left和top
var x = p.left + that.width();//获取这个浮动层的left
var docWidth = $(document).width();//获取网页的宽
if (x > docWidth – div.width() – 20) {
x = p.left – div.width();
}
div.css(“left”, x);
div.css(“top”, p.top);
//$(“#tm”).show();
},
outEvent : function() {
$(“#tm”).hoverDelay( {
outDuring :1000,
hoverEvent : function() {
test = “on”;
$(“#tm”).show();
},
outEvent : function() {
test=””;
$(“#tm”).hide();
}
});
if(test==””){
$(“#tm”).hide();
}
}
});
});










