Hovers/Mouseovers

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mgalloway
    New Member
    • Feb 2007
    • 5

    #1

    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.

    Code:
    var IE = document.all?true:false;
    document.onmousemove=mousemove;
    
    var tempX = 0;
    var tempY = 0;
    
    function mousemove(e) {
    	if(!IE) {
    			tempX = e.pageX;
    			tempY = e.pageY;	
    		}
    	
    	return false;
    }
    
    
    
    
    function getMouseXY(e) {
       tempX = event.clientX + document.documentElement.scrollLeft;
       tempY = event.clientY + document.documentElement.scrollTop;
       return true;
    }
    
    
    function funcshowdiv(divname, moveYN)
    {    
    
    if(IE) {getMouseXY();}
    
    
    //alert('x: ' + tempX + ' y: ' + tempY);
    
    if (tempX < 0){tempX = 0;}
    if (tempY < 0){tempY = 0;} 
    tempX = tempX - 10;
    tempY = tempY - 10;
    
    
        if(IE){
        	var obj;
        	obj = eval('document.all.' + divname)
        	obj.style.display= ''; 
        	if (moveYN)
        	{
        		obj.style.top = tempY + 'px';
        		obj.style.left = tempX + 'px';
        	}
        } else {
        	if(document.getElementById(divname).style.display!= ''){ 
    		document.getElementById(divname).style.display= ''; 
    		document.getElementById(divname).style.left= tempX + 'px';
    		document.getElementById(divname).style.top= tempY + 'px';
    	}
        }   
    
    
    }
       
    
        
    function funchidediv(divname, moveYN)
    {
        if(document.layers) 
        { // browser="NN4"; 
        document.layers[divname].display= 'none'; 
        } 
        if(document.all) { // browser="IE"; 
        var obj;
        obj = eval('document.all.' + divname)
        obj.style.display= 'none'; 
        
        } 
        if(!document.all && document.getElementById){ // browser="NN6+ or IE5+ if you're willing to dump the !document.all stuff"; 
        document.getElementById(divname).style.display= 'none'; 
        }   
       
    }
  • acoder
    Recognized Expert MVP
    • Nov 2006
    • 16032

    #2
    This is old code. There's no need to use document.all and document.layers . Just use the standard document.getEle mentById, unless you want to support old buggy browsers. See this link for some help.

    Comment

    Working...