While I have hundreds of draggables, the performance is very
dramatical.
So I want to hear from you if its possible to write code around it.
Have you devs a solution to create a draggable on the mousedown
event?

The problem I face now, is: that I can create on the mousedown a
draggable, but it wont following my mouse. If I reclick it, then it
follows my mouse.

Currently I have the following not working code:

<!DOCTYPE html> 
<html> 
<head> 
  <link type="text/css" href="http://jqueryui.com/latest/themes/base/ 
ui.all.css" rel="stylesheet" /> 
  <script type="text/javascript" src="http://jqueryui.com/latest/ 
jquery-1.3.2.js"></script> 
  <script type="text/javascript" src="http://jqueryui.com/latest/ui/ 
ui.core.js"></script> 
  <script type="text/javascript" src="http://jqueryui.com/latest/ui/ 
ui.draggable.js"></script> 
  <style type="text/css"> 
    #draggable { width: 100px; height: 70px; background: silver; } 
  </style> 
  <script type="text/javascript"> 


    $(document).ready(function(){ 


        $(".drag").mousedown( function(event){ 


            $("#draggable").draggable(); 
            $("#draggable").trigger("mousedown.draggable", [event]) 
         }); 


    }); 
  </script> 
</head> 
<body style="font-size:62.5%;"> 


<div id="draggable" class="drag">Drag me</div> 


</body> 
</html> 

How to deal with this problem, can you suggest something for me?

  • No Related Post