Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

87
Views
Prevent click after dragging

I have a draggable icon that opens a popup when clicked, but it opens the popup if you drag the icon and then let go of the mouse button. I need to stop this from happening.

I had this figured out but messed up my code. If someone can adjust my code below to stop the click happening after drag, that would be super helpful!

jQuery(document).ready(function($) {
  $(function() {
    $(".icon").draggable({
      containment: "#containment-wrapper",
      stop: function(e, ui) {
        var perc = ui.position.left / ui.helper.parent().width() * 100;
        ui.helper.css('left', perc + '%');
      }
    })
    
    $("[data-popup]").on('click', function() {
      var target = $(this).data('popup');
      target = "#" + target;
      var $targetEl = $(target)
      $targetEl.show();
      $targetEl.css('zIndex', popupZIndex);
      popupZIndex += 1;
    });
  });
});

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!