JavaScript Prevent `click` while the link is dragged prevent click while dragging,jquery prevent click while loading,jquery

I'm using gridster to make a grid of links. The link should work normal when click on it. Problem is it's also get clicked after dragged. How can I stop it from being clicked after dragged?

Please check: http://jsfiddle.net/b_m_h/tr4cU/

<div class="gridster">
    <ul id="reszable">
        <li data-row="1" data-col="1" data-sizex="1" data-sizey="1"></li>
        <li data-row="2" data-col="1" data-sizex="1" data-sizey="1"></li>
        <li data-row="3" data-col="1" data-sizex="1" data-sizey="1"><a target='_blank' href="http://google.com" target="_blank">LINK</a></li>
        <li data-row="1" data-col="2" data-sizex="2" data-sizey="1"></li>
        <li data-row="2" data-col="2" data-sizex="2" data-sizey="2"></li>
        <li data-row="1" data-col="4" data-sizex="1" data-sizey="1"></li>
    </ul>
</div>

Js:

$(function(){

    $(".gridster ul").gridster({
        widget_margins: [5, 5],
        widget_base_dimensions: [100, 100]
    });

    var gridster = $(".gridster ul").gridster().data('gridster');

});
Answer:1

I'm not sure this could help, but just for an idea

Instead of making complete griddle as clickable, why not use only Link as clickable, what i mean is

<li data-row="3" data-col="1" data-sizex="1" data-sizey="1">
    <p> <a target='_blank' href="http://google.com" target="_blank">LINK</a></p></li>

Doing this will fulfill what you needed, have tried this and it works

    <div class="gridster">
    <ul id="reszable">
<li data-row="1" data-col="1" data-sizex="2" data-sizey="1"></li>
<li data-row="2" data-col="1" data-sizex="1" data-sizey="1"></li>
<li data-row="3" data-col="1" data-sizex="1" data-sizey="1">
    <p> <a target='_blank' href="http://google.com" target="_blank">LINK</a></p></li>
<li data-row="1" data-col="2" data-sizex="2" data-sizey="1"></li>
<li data-row="2" data-col="2" data-sizex="2" data-sizey="2"></li>
<li data-row="1" data-col="4" data-sizex="1" data-sizey="1"></li>

Answer:2
draggable: {
        start: function(event, ui) {

            dragged = 1;
            // DO SEOMETHING
        }
    }

...
    if(!dragged){
        // DO SOMETHING
    }
    // RESET DRAGGED SINCE CLICK EVENT IS FIRED AFTER drag stop
dragged = 0

How do I avoid a click event firing after dragging a gridster.js widget with clickable content?

I think that link answers the same question

Answer:3

I'm using angularjs 1.3.2. How to get clipboard data on paste event? This question is like: "Paste" event in Angular [ngPaste] But in this question, the angularjs version is 1.2. And this ...

I'm using angularjs 1.3.2. How to get clipboard data on paste event? This question is like: "Paste" event in Angular [ngPaste] But in this question, the angularjs version is 1.2. And this ...

  1. paste clipboard data javascript
  2. paste clipboard data vba
  3. paste clipboard data in c#
  4. paste clipboard data to excel c#
  5. paste clipboard data
  6. clipboard data not suitable for paste

My replace all function is as below, it is in commonHelper.js file exports.replaceAll = function (find, replace, str) { return str.replace(new RegExp(find, 'g'), replace); } Then I do following ...

My replace all function is as below, it is in commonHelper.js file exports.replaceAll = function (find, replace, str) { return str.replace(new RegExp(find, 'g'), replace); } Then I do following ...

  1. search replace javascript
  2. location.search.replace javascript
  3. search replace string javascript
  4. search and replace javascript regex
  5. regex search replace javascript
  6. javascript search replace all
  7. javascript search replace text
  8. javascript search replace array
  9. search and replace html javascript
  10. str search and replace javascript
  11. javascript search replace characters

I'm using a content-script in a chrome extension that I'm writing. I included geolocation in my list of permissions, but on every webpage I still get asked if I want to share my location. I thought ...

I'm using a content-script in a chrome extension that I'm writing. I included geolocation in my list of permissions, but on every webpage I still get asked if I want to share my location. I thought ...

I have a casperJS script which returns JSON when run via commandline. I want to make an API preferably in PHP which runs the script as in commandline (casperJS sample.js) and returns the JSON as ...

I have a casperJS script which returns JSON when run via commandline. I want to make an API preferably in PHP which runs the script as in commandline (casperJS sample.js) and returns the JSON as ...