开发者

Is there a way to force Firefox to redisplay a title/tooltip?

开发者 https://www.devze.com 2023-02-01 16:37 出处:网络
I am using some JavaScript to change the title of an element.However, I realize now that firefox does not display the new title.You have to move the mouse off of the element, and then move it back, ju

I am using some JavaScript to change the title of an element. However, I realize now that firefox does not display the new title. You have to move the mouse off of the element, and then move it back, just to get it to work. Since I am working with a large element that take up lot of the screen, the user would not be likely get this very easlily.

Is there some way to force Firefox to redisplay the title?

Maybe there is a way to force Firefox to 开发者_Go百科rerender the element or something like that?

Thanks, Grae


I would recommend using something like a jQuery tooltip to accomplish this, see here: http://docs.jquery.com/Plugins/tooltip


I solved the same issue with this javascript. For every element where I need this behaviour I do (element is obviously the name of the element ;o) )

if (element.disabled)
{
  element.title=element.value;
}
else
{
  element.onmouseover=function(){element.title=element.value;};
  element.onmouseout=function(){element.title=null;};
}

if the element is disabled, just set the title at first... I set the element at null on the mouseover, because otherwise it will shortly show the old one and then correct it.


The only way I can think of is to use a library to display tooltips.

Something like this: http://flowplayer.org/tools/tooltip/index.html doesn't use actual tooltips, but can display the data easily. And I'm sure you can update the content that is displayed if needed.

0

精彩评论

暂无评论...
验证码 换一张
取 消