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 6952185
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T14:18:59+00:00 2026-05-27T14:18:59+00:00

tl;dr JSFiddle URL: http://jsfiddle.net/66Mck/ I have a Drag UI I’m working on, and I’m

  • 0

tl;dr JSFiddle URL: http://jsfiddle.net/66Mck/

I have a Drag UI I’m working on, and I’m having trouble with <a> tags inside the drag interface.

I want people to be able to drag anywhere inside the UI, including <a> tags because they are a big metro style tile.

The goal is, if they click on an <a> and drag less than 20 px, the link fires, otherwise the drag should just move the panel.

The entire event in question is below, but the part to focus on is:

if (Math.abs(distance - initialPosition) > 20) {
 $('a').mouseup(function (e) { e.preventDefault(); });
}

Whole event below:

$('#panorama').mousedown(function (e) {
    initialPosition = e.pageX - $('#panorama').position().left;
    previousPosition = $('#panorama').position().left;
    $(document).mousemove(function (e) {
        distance = e.pageX - initialPosition;
        $('#panorama').css({ 'left': distance });
        if (Math.abs(distance - initialPosition) > 20) {
            $('a').mouseup(function (e) { e.preventDefault(); });
        }
        return false;
    });
    $(document).one('mouseup', function () {
        $(document).unbind();
        if (snapTo) {
            metroUI.intelliIncrement();
        }
    });
    return false;
});

Currently the drag length sensor works properly, but neither .click() nor .mouseup() handle the event, because the .mousedown() portion of the .click() has already fired in the parent element $('#panorama').mousedown

  • 1 1 Answer
  • 3 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-05-27T14:19:00+00:00Added an answer on May 27, 2026 at 2:19 pm

    Got it to work the way you want by (a) fixing distance calculation and (b) my negating <a> tag click event instead of mouseup.

    Have updated your fiddle with both fixes.

    Have put some debug code in the mouseup handler.

    Updated fiddle here: http://jsfiddle.net/66Mck/29/

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

Sidebar

Related Questions

JSFiddle URL: http://jsfiddle.net/sFe45/ Code: <html> <head> <title>Foo</title> <script type=text/javascript> var target; var anchor; function
The html code is pasted into this url http://jsfiddle.net/nzYjV/ The div (id=input) contains the
Here is the JSfiddle: http://jsfiddle.net/buyC9/128/ I want to clear only the file upload field
I have a jsFiddle here : http://jsfiddle.net/ZXDYS/22/ I am creating Blogger post summaries using
Please refer the url http://jsfiddle.net/fnvXT/ Here while selecting the check box the corresponding row
I searched a background animation samples in web. i found this url : http://jsfiddle.net/rwaldron/TzWQA/
I've setup a demo of my problem at the following url: http://jsfiddle.net/YHHg7/4/ I'm trying
http://jsfiddle.net/sMMHW/ In the fiddle above I have a small little red 1 pixel line
JS fiddle : http://jsfiddle.net/Rkh8L/ I am trying to vertically middle div inside div. The
http://jsfiddle.net/ZkAdt/8/ Take the URL: http://www.youtube.com/watch?v=B8c2G7RN0TM and paste it into the input field. Observe the

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.