Win a copy of Transfer Learning for Natural Language Processing (MEAP) this week in the Artificial Intelligence and Machine Learning forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • Paul Clapham
  • Devaka Cooray
  • Bear Bibeault
Sheriffs:
  • Junilu Lacar
  • Knute Snortum
  • Liutauras Vilda
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Piet Souris
Bartenders:
  • salvin francis
  • Carey Brown
  • Frits Walraven

Div popup

 
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I have to implement a pop up that appears onmouseover and follows the mouse as long as it's over a given div. It's something like what you get whith the title attribute, but the context could be more than text.
Now I'm doing this:



And this is called like this:


(The events are with spaces because it was throwing an error when posting)
The problem is that in firefox, the div appears, but when I stop moving the mouse, even if the cursor remains inside the container div, the popup disappears. In IE it works (ironically) fine.

Thanks a lot
Pablo.
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The problem is you are placing the layer right under the mouse so it is firing the onmouseout and onmouseover in a loop as it creates and destroys the element.

Simple fix would be to add an offset

theDiv.style.left = (x + 5) +"px";
theDiv.style.top = (y + 5) +"px";

The code could use some tweaks, but it should work.

Eric
 
Pablo M�ller
Ranch Hand
Posts: 63
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks a lot, that worked fine.
So, after all firefox was doing what it was supposed to do, and IE... well, it was just being IE .
Pablo
 
Yes, of course, and I accept that blame. In fact, i covet that blame. As does this tiny ad:
Two software engineers solve most of the world's problems in one K&R sized book
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic