Hello,

I'm seeking an onmouseover event to detect when the mouse hovers the top of the webpage. I'm only able to find onmouseover events for the whole page. How to restrict to just the very top of the page?

Need only support modern browsers, simplest method possible.

Thx!

(also asked on codingforums.com and stackoverflow)

What is the top of the page for you ? How do you define it ?

The statement that you asked elsewhere as well has nothing to do with increasing the possibilities of getting an answer , it rather declines those.

To do so, you must attach the onmouseover event to the element on the top of your page. In other words, you must design your page layout, such that your page is divided into sections. Once you have a layout, then attach the event to only element you want the event to be triggered.

<html>
<head>
</head>
<body>
<div style='top:0;position:fixed;z-index:30;' onmouseover='whatever;'>
Inline styles and javascripts are bad mkay
but this div will remain at the top of the page
and do whatever on mouseover</div>
<div>
This is content
</div>
</body>
</html>

With compliments to Taywin

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.