Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8996651
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 15, 20262026-06-15T23:46:58+00:00 2026-06-15T23:46:58+00:00

http://jsfiddle.net/TMmgt/4/ html: <a href=javascript:void(0);>some text</a>​ js: var down=false; $(‘a’).mousedown(function(){ down=true; }); $(‘a’).mouseup(function(){ down=false; });

  • 0

http://jsfiddle.net/TMmgt/4/

html:

<a href="javascript:void(0);">some text</a>​

js:

var down=false;    

$('a').mousedown(function(){
    down=true;
});

$('a').mouseup(function(){
    down=false;
});

$('a').mousemove(function(){
    if(down){
       console.log('Mouse is still down!');
       // do something        
    }
});

$(window,document,'body').mouseup(function(){
    down=false;
});​

Drag link anywhere in the body and release, then move cursor over the link again.
Mouse move will still be showing that down is true, because mouseup was not triggered and haven’t changed it to false. Then just click anywhere in body and move over link again. Now down is true

Any workaround for this issue?

As i understand, it’s because of default browser <a> drag behavior.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-15T23:46:59+00:00Added an answer on June 15, 2026 at 11:46 pm

    http://jsfiddle.net/TMmgt/5/

    var down=false;
    
    
    $('a').mousedown(function(e){
        e.preventDefault();
        down=true;
    });
    
    $('body').mouseup(function(e){
        e.preventDefault();
        down=false;
        check();
    });
    
    $('a').mousemove(function(e){
        e.preventDefault();
        if(down){
           console.log('Mouse is still down!');
           // do something        
        }
    });
    
    function check(){
        if(down==false) {
        console.log('Mouse is up!');
    }
    }
    

    ​

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

http://jsfiddle.net/uGyTB/ var s = $(<li><a href='index.html'><h3>hello</h3></a></li>); alert(s.html());​ Shows that the li element is not
http://jsfiddle.net/GGsEt/3/ Works on firefox HTML <ul> <li class="lib_undefined"> <span class="hidden_toggle"> <a href="/">Test</a> </span> </li>
http://jsfiddle.net/2N854/ html: <img alt=test width=100 height=100> javascript: alert($('img').height()); On most browsers (chrome), the alert
http://jsfiddle.net/borayeris/6kvyb/ <ul> <li>foo</li> <li>bar</li> </ul> <script> $('li').each(function(index) { var qq=$(this).text(); alert(index + ': '
http://jsfiddle.net/F7BTx/ I'm trying to align just some text within a table header cell to
http://jsfiddle.net/CsrrD/ Given an object var viewModel = { Opts: ko.observableArray([ { d: 'a', v:
http://jsfiddle.net/h2vMN/1/ I have a text box text inside it already, in the actual application
http://jsfiddle.net/skowron_line/zPCBc/1/ var d1 = '31.05.2012'; var d2 = '01.06.2012'; var s1 = d1.split('.'); var
http://jsfiddle.net/nWqYL/2/embedded/result/ I've been working on fixing some issues with this prototype site. Myself and
http://jsfiddle.net/f4hmL/235/ function showData() { alert(boop!); } function method1() { var dfd = $.Deferred(); setTimeout(dfd.resolve(),

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.