Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > ScrollTop Issue in Firefox

Reply
Thread Tools

ScrollTop Issue in Firefox

 
 
velhari
Guest
Posts: n/a
 
      06-17-2008
Hi all,

I was showing the popup while hovering over an element under overflow
div. so i am getting top and left of current hovering element to
display popup with that top and left position.
In IE it positioned exactly where i was hovering, But in firefox it
was misplaced under the overflow div[Not exactly what position i
hovered]

My sample code
<div id="overflowdiv" style="overflow:scroll;height:100;width:100">
<ul style="list-style-type:none">
<li><a href="Javascript:void(0);"
onMouseOver="getScrollTop(this)">Test Element 1</a></li>
<li><a href="Javascript:void(0);"
onMouseOver="getScrollTop(this)">Test Element 2</a></li>
<li><a href="Javascript:void(0);"
onMouseOver="getScrollTop(this)">Test Element 3</a></li>
<li><a href="Javascript:void(0);"
onmouseover="getScrollTop(this)">Test Element 4</a></li>
<li><a href="Javascript:void(0);"
onmouseover="getScrollTop(this)">Test Element 5</a></li>
<li><a href="Javascript:void(0);"
onmouseover="getScrollTop(this)">Test Element 6</a></li>
<li><a href="Javascript:void(0);"
onmouseover="getScrollTop(this)">Test Element 7</a></li>
<li><a href="Javascript:void(0);"
onmouseover="getScrollTop(this)">Test Element 8</a></li>
<li><a href="Javascript:void(0);"
onmouseover="getScrollTop(this)">Test Element 9</a></li>
<li><a href="Javascript:void(0);"
onMouseOver="getScrollTop(this)">Test Element 10</a></li>
<li><a href="Javascript:void(0);"
onmouseover="getScrollTop(this)">Test Element 11</a></li>
<li><a href="Javascript:void(0);"
onmouseover="getScrollTop(this)">Test Element 12</a></li>
<li><a href="Javascript:void(0);"
onmouseover="getScrollTop(this)">Test Element 13</a></li>
<li><a href="Javascript:void(0);"
onmouseover="getScrollTop(this)">Test Element 14</a></li>
<li><a href="Javascript:void(0);"
onmouseover="getScrollTop(this)">Test Element 15</a></li>
<li><a href="Javascript:void(0);"
onmouseover="getScrollTop(this)">Test Element 16</a></li>
</ul>
</div>
<div id="showdiv"
style="left:-100;top:-100;position:absolute;background-
color:#FFFF00;color:#000000">Please help me to resolve this issue</
div>
<script language="javascript">
function getScrollTop( element ){
var l = t = 0;
while( element != null ) {
l += element.offsetLeft;
t += element.offsetTop;
if ( element.nodeName != 'BODY' ){
l -= element.scrollLeft;
t -= element.scrollTop;
}
element = element.offsetParent;
}
document.getElementById('showdiv').style.left = l;
document.getElementById('showdiv').style.top = t;
//return {left:l, top:t};
}
</script>
Please tell me what is the problem
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
HTML document.body.scrollTop question =?Utf-8?B?SGFyZHkgV2FuZw==?= ASP .Net 2 02-23-2007 12:27 AM
SOLUTION: Body onscroll, scrollTop, scrollLeft not working with master pages ??? bluegrasslover@gmail.com ASP .Net 0 11-25-2006 01:59 AM
SOLUTION: Body onscroll, scrollTop, scrollLeft not working with master pages ??? bluegrasslover@gmail.com ASP .Net 0 11-25-2006 01:59 AM
master pages and scrollTop = 0 =?Utf-8?B?QW5keQ==?= ASP .Net 9 05-17-2006 03:51 PM
Body onscroll, scrollTop, scrollLeft not working with master pages ??? gregtyndall@gmail.com ASP .Net 0 12-29-2005 04:39 PM



Advertisments