Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 9 of 9
  1. #1
    Regular Coder
    Join Date
    Mar 2007
    Posts
    357
    Thanks
    46
    Thanked 22 Times in 21 Posts

    [Solved] IE Help

    Ok it's not as solved as I thought.

    Code:
    <script type="text/javascript">
    var newFade = 0;
    var doMouse = 0;
    var doFade = 1;
    document.onmousemove=getMouseCoordinates;
    var scnWid,scnHei;
    function setMenu() {
    	document.getElementById('menu').height = document.body.offsetHeight + 'px';
    }
    function menuOver() {
    	doMouse = 1;
    	if (doFade == 1) {
    		newFade = 0;
    		fadeIn();
    	}
    }
    function menuOut() {
    	doMouse = 0;
    	if (doFade == 0) {
    		newFade = 1;
    		fadeOut();
    	}
    }
    function fadeIn() {
    	newFade += 0.1;
    	document.getElementById('spacer').style.opacity = newFade;
    	document.getElementById('spacer').style.MozOpacity = newFade;
    	document.getElementById('spacer').style.filter = "alpha(opacity ="+ (newFade * 100) +");";
    	if (newFade < 1) {
    		setTimeout("fadeIn()", 20);
    	}
    	doFade = 0
    }
    function fadeOut() {
    	newFade -= 0.1;
    	document.getElementById('spacer').style.opacity = newFade;
    	document.getElementById('spacer').style.MozOpacity = newFade;
    	document.getElementById('spacer').style.filter = "alpha(opacity ="+ (newFade * 100) +");";
    	if (newFade > 0) {
    		setTimeout("fadeOut()", 20);
    	}
    	doFade = 1;
    }
    function getMouseCoordinates(event) {
    	ev = event || window.event;
    	if (doMouse == 1 && (ev.clientY >= 110)) {
    		document.getElementById('spacer').style.top = (ev.clientY - (document.getElementById('spacer').offsetHeight / 2)) + 'px';
    	}
    }
    </script>
    Last edited by flynch01; 06-24-2008 at 11:11 PM.

  • #2
    Regular Coder
    Join Date
    Mar 2007
    Posts
    357
    Thanks
    46
    Thanked 22 Times in 21 Posts
    Sorry to bump but, I'm kindof stuck until this works. No one?

  • #3
    Senior Coder tomws's Avatar
    Join Date
    Nov 2007
    Location
    Arkansas
    Posts
    2,644
    Thanks
    29
    Thanked 330 Times in 326 Posts
    Have a link?

  • #4
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,862
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    but internet explorer doesn't even move,
    you may have to use ev.clientY

    and also try filter property for IE, say
    Code:
    document.getElementById('spacer').style.filter="alpha(opacity = "+newFade+");";
    Last edited by abduraooft; 06-24-2008 at 03:43 PM.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • Users who have thanked abduraooft for this post:

    flynch01 (06-24-2008)

  • #5
    Regular Coder
    Join Date
    Mar 2007
    Posts
    357
    Thanks
    46
    Thanked 22 Times in 21 Posts
    I see, hold on let me try.
    Edit: Thanks a million, really appreciate it!
    Last edited by flynch01; 06-24-2008 at 03:39 PM.

  • #6
    Supreme Master coder! abduraooft's Avatar
    Join Date
    Mar 2007
    Location
    N/A
    Posts
    14,862
    Thanks
    160
    Thanked 2,223 Times in 2,210 Posts
    Quote Originally Posted by flynch01 View Post
    I see, hold on let me try.
    Edit: Thanks a million, really appreciate it!
    You're welcome, but please keep your code there(than removing), as it may help some others.
    The Dream is not what you see in sleep; Dream is the thing which doesn't let you sleep. --(Dr. APJ. Abdul Kalam)

  • #7
    Regular Coder
    Join Date
    Mar 2007
    Posts
    357
    Thanks
    46
    Thanked 22 Times in 21 Posts
    Not so solved anymore actually. ClientX/Y is where your mouse is in relation to the window, wheras PageX/Y is in relation to the document. So if I scroll down the page, it won't be like, Y won't be 500, it'll still be where the mouse is in relation to the window. So it'll be 39 no matter how far down I scroll.

    Re-pasting javavascript sorry.

    I need to find out in relation to the document.

  • #8
    Smokes a Lot
    Join Date
    Jul 2003
    Location
    CA, USA
    Posts
    1,594
    Thanks
    5
    Thanked 20 Times in 20 Posts
    Here is code to get mouse coordinates:

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
            <title>CF Help</title>
            <script type="text/javascript">
                //*******************************************************
                // Mouse Co-Ords
                //*******************************************************
                
                function mouseXY(e){
                    if (!e){
                        var e = window.event;
                    }
                    if (e.clientX){  
                        posX = e.clientX + document.documentElement.scrollLeft;
                        posY = e.clientY + document.documentElement.scrollTop;
                    }else{
                        posX = Math.max(e.pageX,0);
                        posY = Math.max(e.pageY,0);
                    }
                    var coord=new Array();
                    coord[0]=posX;
                    coord[1]=posY;
                    return coord;
                }
                if(document.captureEvents){
                 document.captureEvents(Event.MOUSEMOVE)
                }
                document.onmousemove=function(event){
                    var xy=mouseXY(event);
                    document.getElementById("coords").innerHTML=xy;
                    document.getElementById("coords2").innerHTML=xy;
                }
            </script>
        </head>
        <body>
            <div id="coords"></div>
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <br />
            <div id="coords2"></div>
        </body>
    </html>
    Basscyst
    Helping to build a bigger box. - Adam Matthews

  • Users who have thanked Basscyst for this post:

    flynch01 (06-24-2008)

  • #9
    Regular Coder
    Join Date
    Mar 2007
    Posts
    357
    Thanks
    46
    Thanked 22 Times in 21 Posts
    Ah, fantastic. Thanks for that,


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •