Jump to content
  • 0

как ограничить toolbox в средней ячейке?


sstyle
 Share

Question

Есть такая штука. в title прописываешь текст и при наведении на объект он появляется рядом с курсором в блоке.

делается так

JS:

var _w=window,_d=document;
_w.onerror = null;
var tooltip_attr_name = "tooltip",tooltip_len=45;

_w.onload=function(e){if(_d.createElement)tooltip.d();}

tooltip={
t: _d.createElement("DIV"),
c: null,
g: false,

m: function(e)
{
if (tooltip.g)
{
oCanvas=_d.getElementsByTagName((_d.compatMode&&_d.compatMode=="CSS1Compat")?"HTML":"BODY")[0];
x=_w.event?event.clientX+oCanvas.scrollLeft:e.pageX;
y=_w.event?event.clientY+oCanvas.scrollTop:e.pageY;
tooltip.a(x,y);
}
},

d: function()
{
tooltip.t.setAttribute("id", "tooltip");
//tooltip.t.style.filter = "alpha(opacity=85)"; // buggy in ie5.0
_d.body.appendChild(tooltip.t);
a=_d.all?_d.all:_d.getElementsByTagName("*");
aLength=a.length;
for(var i=0;i<aLength;i++)
{
if (a[i].getAttribute("title"))
{
a[i].setAttribute(tooltip_attr_name,a[i].getAttribute("title"));
if (a[i].getAttribute(tooltip_attr_name)){
a[i].removeAttribute("title");
if (a[i].getAttribute("alt") && a[i].complete) a[i].removeAttribute("alt");
tooltip.l(a[i],"mouseover",tooltip.s);
tooltip.l(a[i],"mouseout",tooltip.h);
}
}

}
_d.onmousemove = tooltip.m;
_w.onscroll = tooltip.h;
},

s: function(e){
d=_w.event?_w.event.srcElement:e.currentTarget;
if(!d.getAttribute(tooltip_attr_name))return;
if(tooltip.t.firstChild)tooltip.t.removeChild(tooltip.t.firstChild);
tooltip.t.appendChild(_d.createTextNode(d.getAttribute(tooltip_attr_name)));
tooltip.c=setTimeout("tooltip.t.style.visibility='visible';",1);
tooltip.g=true;
var tmp=d.getAttribute(tooltip_attr_name);
tooltip.t.setAttribute("id",(tmp.length>tooltip_len)?"tooltip_big":"tooltip");
},

h: function(e){
tooltip.t.style.visibility = "hidden";
// thanks to Alexander Shurkayev for helping me optimise this line :-)
if (tooltip.t.firstChild)
tooltip.t.removeChild(tooltip.t.firstChild);
clearTimeout(tooltip.c);
tooltip.g = false;
tooltip.a(-99, -99);
},

l: function(o,e,a){
if(o.addEventListener)o.addEventListener(e,a,false);
// was true--Opera7b workaround!
else if(o.attachEvent)o.attachEvent("on"+e,a);
else return null;
},

a: function(x,y){
oCanvas=_d.getElementsByTagName((_d.compatMode &&_d.compatMode=="CSS1Compat")?"HTML":"BODY")[0];
w_width=_w.innerWidth?_w.innerWidth+_w.pageXOffset:oCanvas.clientWidth+oCanvas.scrollLeft;
w_height=_w.innerHeight?_w.innerHeight+_w.pageYOffset:oCanvas.clientHeight+oCanvas.scrollTop;

t_width=_w.event?tooltip.t.clientWidth:tooltip.t.offsetWidth;
t_height=_w.event?tooltip.t.clientHeight:tooltip.t.offsetHeight;

t_extra_width=7;
// CSS padding + borderWidth;
t_extra_height=5;
// CSS padding + borderHeight;

tooltip.t.style.left=x+8+"px";
tooltip.t.style.top=y+8+"px";

while(x+t_width+t_extra_width>w_width){
x-=x+t_width+t_extra_width-w_width;
tooltip.t.style.left=x+"px";
t_width=_w.event?tooltip.t.clientWidth:tooltip.t.offsetWidth;
}

while(y+t_height + t_extra_height > w_height){
y-=y+t_height + t_extra_height - w_height;
tooltip.t.style.top = y + "px";
t_height=_w.event?tooltip.t.clientHeight:tooltip.t.offsetHeight;
}
}
}

CSS:

#tooltip {
background: #ffffd4;
color:#2347a1;
border: 1px solid #b1b1b1;
text-align: left;
font: 11px Verdana, Helvetica,sans-serif;
margin:0px;
padding: 5px;
position:absolute;
z-index:5;
visibility:hidden;
box-shadow: 0 0 5px #dbdbdb;
-webkit-box-shadow: 0 0 5px #dbdbdb;
-moz-box-shadow: 0 0 5px #dbdbdb;
}
#tooltip_big{
width:200px;
color:#2347a1;
background: #ffffd4;
border: 1px solid #b1b1b1;
text-align: left;
font: 11px Verdana, Helvetica,sans-serif;
margin:0px;
padding: 5px;
position:absolute;
visibility:hidden;
box-shadow: 0 0 8px #dbdbdb;
-webkit-box-shadow: 0 0 8px #dbdbdb;
-moz-box-shadow: 0 0 8px #dbdbdb;
filter:alpha(opacity=90);
-moz-opacity: 0.9;
-khtml-opacity: 0.9;
opacity: 0.9;
}

проблема в том, что на сайте три колонки. в левой и правой - Flash баннеры, которые закрывают собой появляющиеся подписи (в ИЕ как обычно...) как бы сделать так чтобы они были внутри только среднего блока?

Link to comment
Share on other sites

0 answers to this question

Recommended Posts

There have been no answers to this question yet

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Answer this question...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

 Share

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue. See more about our Guidelines and Privacy Policy