5 Replies Latest reply on Oct 17, 2013 7:28 AM by RavenDesign

    Code working in HTML doc but doesn't in Edge ?

    RavenDesign Level 1

      So My Jquery code works out of Edge but doesn't in Edge What I am trying to do is move the Background IMG when the mouse moves

      Code:

       

      var tempX = 0;

      var tempY = 0;

      var oldTempX = 0;

      var oldTempY = 0;

      var IE =  !!(window.attachEvent&&!window.opera);

       

       

      function shiftImageXY(e) {

        if (IE) {

          tempX = event.clientX + document.body.scrollLeft;

          tempY = event.clientY + document.body.scrollTop;

        } else { 

          tempX = e.pageX;

          tempY = e.pageY;

        } 

        img = document.getElementById('#Stage_background');

        speedFactorDamping = 0.1;

        xdir = (tempX - oldTempX) ;

        ydir = (tempY - oldTempY) ;

        parallexX = -xdir*speedFactorDamping;

        parallexY = -ydir*speedFactorDamping;

        currX = parseInt(img.offsetLeft);

        currY = parseInt(img.offsetTop);

       

       

        img.style.left = (currX + parallexX) + 'px';

        img.style.top = (currY + parallexY) + 'px';

        oldTempX = tempX;

        oldTempY = tempY;

        return true;

      }

       

       

      document.onmousemove = shiftImageXY;

       

       

       

      any idea thanks in advance

       

       

      here is the fiddle: http://jsfiddle.net/NjVg9/