Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • How to get mouse current position

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 255
    Comment on it

    According to my below code, when we will move the mouse to anywhere like left or right up and down we get the current status of the swipe. Here i have used mousemove() method .

     $(function() {      
          //Enable swiping...
          $("#test").swipe( {
            swipeStatus:function(event, phase, direction, distance, duration, fingers)
            {
              var str = "<h4>Swipe Phase : " + phase + "<br/>";
              str += "Direction from inital touch: " + direction + "<br/>";
              str += "Distance from inital touch: " + distance + "<br/>";
              str += "Duration of swipe: " + duration + "<br/>";
              str += "Fingers used: " + fingers + "<br/></h4>";
    
              //Here we can check the:
              //phase : 'start', 'move', 'end', 'cancel'
              //direction : 'left', 'right', 'up', 'down'
              //distance : Distance finger is from initial touch point in px
              //duration : Length of swipe in MS 
              //fingerCount : the number of fingers used
              if (phase!="cancel" && phase!="end") {
                if (duration<5000)
                  str +="Here maxTimeThreshold.<h3>Swipe handler will be triggered if you release at this point.</h3>"
                else
                  str +="Here Over maxTimeThreshold. <h3>Swipe handler will be canceled if you release at this point.</h3>"
    
                if (distance<200)
                  str +="Not yet reached threshold.  <h3>Swipe will be canceled if you release at this point.</h3>"
                else
                  str +="Threshold reached <h3>Swipe handler will be triggered if you release at this point.</h3>"
              }
    
              if (phase=="cancel")
                str +="<br/>Handler not triggered. <br/> One or both of the thresholds was not met "
              if (phase=="end")
                str +="<br/>Handler was triggered."  
    
              $("#test").html(str);
            },
            threshold:200,
            maxTimeThreshold:5000,
            fingers:'all'
          });
        });
    $(function() {      
          //Enable swiping...
          $("#test").swipe( {
            swipeStatus:function(event, phase, direction, distance, duration, fingers)
            {
              var str = "<h4>Swipe Phase : " + phase + "<br/>";
              str += "Direction from inital touch: " + direction + "<br/>";
              str += "Distance from inital touch: " + distance + "<br/>";
              str += "Duration of swipe: " + duration + "<br/>";
              str += "Fingers used: " + fingers + "<br/></h4>";
    
              //Here we can check the:
              //phase : 'start', 'move', 'end', 'cancel'
              //direction : 'left', 'right', 'up', 'down'
              //distance : Distance finger is from initial touch point in px
              //duration : Length of swipe in MS 
              //fingerCount : the number of fingers used
              if (phase!="cancel" && phase!="end") {
                if (duration<5000)
                  str +="Here maxTimeThreshold.<h3>Swipe handler will be triggered if you release at this point.</h3>"
                else
                  str +="Here Over maxTimeThreshold. <h3>Swipe handler will be canceled if you release at this point.</h3>"
    
                if (distance<200)
                  str +="Not yet reached threshold.  <h3>Swipe will be canceled if you release at this point.</h3>"
                else
                  str +="Threshold reached <h3>Swipe handler will be triggered if you release at this point.</h3>"
              }
    
              if (phase=="cancel")
                str +="<br/>Handler not triggered. <br/> One or both of the thresholds was not met "
              if (phase=="end")
                str +="<br/>Handler was triggered."  
    
              $("#test").html(str);
            },
            threshold:200,
            maxTimeThreshold:5000,
            fingers:'all'
          });
        });
    

 0 Comment(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: