CNode

table的td相对定位:小提示的js

Ssdfcbs91发布于12 年前最后回复12 年前0 回复4873 浏览0 收藏

self指向的是this,该对象是继承tabelBaseCommon的类(this.prototype = new tabelBaseCommon();)

调用:$("td.hoverTag").each(function(){ var $this = $(this); self.prototype.titTagHover({ hoverControl: $this, tagControl: $this.children("div.titTag"), location: { x: 45, y: -10 }, positon: "position" }); }); 定义:/悬停在hoverControl上显示小提示功能/ /* 参数:{hoverControl:$(td),tagControl:$(xx),position:{x:0,y:0}} */ tabelBaseCommon.prototype.titTagHover = function (o) { if (!o.hoverControl || !o.tagControl) return; var o = $.extend({ location: { x: 0, y: 0 }, positon: "position" }, o); o.hoverControl = $(o.hoverControl); o.tagControl = $(o.tagControl); o.hoverControl.unbind("mouseenter").unbind("mouseleave").hover(function () { var $this = $(this); var offset = $this.offset(); if (o.positon == "position") { var realX = o.location.x; var realY = o.location.y; } else { var realX = offset.left + o.location.x; var realY = offset.top + o.location.y; } o.tagControl.css({ "left": realX + "px", "top": realY + "px" }); o.tagControl.show(); }, function () { o.tagControl.hide(); }); }

查看回复

回复 (0)

暂无回复,成为第一个参与讨论的人。
参与回复
登录后即可参与回复。登录