469,645 Members | 1,595 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,645 developers. It's quick & easy.

Hovers/Mouseovers

I got my problem from yesterday fixed. Looks like when you mouseover a link it will now bring up a preview of the article. My problem is now this, in IE the preview stays put and you can move your mouse to the bottom the the preview to read the whole article. In FF although it pulls up the preview it moves it all over the screen and you can not move your mouse into the preview to click "read more". Please help.

Expand|Select|Wrap|Line Numbers
  1. var IE = document.all?true:false;
  2. document.onmousemove=mousemove;
  3.  
  4. var tempX = 0;
  5. var tempY = 0;
  6.  
  7. function mousemove(e) {
  8.     if(!IE) {
  9.             tempX = e.pageX;
  10.             tempY = e.pageY;    
  11.         }
  12.  
  13.     return false;
  14. }
  15.  
  16.  
  17.  
  18.  
  19. function getMouseXY(e) {
  20.    tempX = event.clientX + document.documentElement.scrollLeft;
  21.    tempY = event.clientY + document.documentElement.scrollTop;
  22.    return true;
  23. }
  24.  
  25.  
  26. function funcshowdiv(divname, moveYN)
  27. {    
  28.  
  29. if(IE) {getMouseXY();}
  30.  
  31.  
  32. //alert('x: ' + tempX + ' y: ' + tempY);
  33.  
  34. if (tempX < 0){tempX = 0;}
  35. if (tempY < 0){tempY = 0;} 
  36. tempX = tempX - 10;
  37. tempY = tempY - 10;
  38.  
  39.  
  40.     if(IE){
  41.         var obj;
  42.         obj = eval('document.all.' + divname)
  43.         obj.style.display= ''; 
  44.         if (moveYN)
  45.         {
  46.             obj.style.top = tempY + 'px';
  47.             obj.style.left = tempX + 'px';
  48.         }
  49.     } else {
  50.         if(document.getElementById(divname).style.display!= ''){ 
  51.         document.getElementById(divname).style.display= ''; 
  52.         document.getElementById(divname).style.left= tempX + 'px';
  53.         document.getElementById(divname).style.top= tempY + 'px';
  54.     }
  55.     }   
  56.  
  57.  
  58. }
  59.  
  60.  
  61.  
  62. function funchidediv(divname, moveYN)
  63. {
  64.     if(document.layers) 
  65.     { // browser="NN4"; 
  66.     document.layers[divname].display= 'none'; 
  67.     } 
  68.     if(document.all) { // browser="IE"; 
  69.     var obj;
  70.     obj = eval('document.all.' + divname)
  71.     obj.style.display= 'none'; 
  72.  
  73.     } 
  74.     if(!document.all && document.getElementById){ // browser="NN6+ or IE5+ if you're willing to dump the !document.all stuff"; 
  75.     document.getElementById(divname).style.display= 'none'; 
  76.     }   
  77.  
  78. }
  79.  
Feb 7 '07 #1
1 953
acoder
16,027 Expert Mod 8TB
This is old code. There's no need to use document.all and document.layers. Just use the standard document.getElementById, unless you want to support old buggy browsers. See this link for some help.
Feb 8 '07 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by bsanderson | last post: by
reply views Thread by mgalloway | last post: by
1 post views Thread by Bart Lateur | last post: by
reply views Thread by gheharukoh7 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.