title: How to trigger jQuery drag() function manually? like $(element).trigger('drag');
body: <p>I have an img element which is draggable. Now I want to trigger the drag() event manually like how do we trigger 'click' event as $(element).trigger('click'). Thanks.</p>
  
  <p>Here is the function definition that I have</p>
  
  <pre><code>$('#imgToUpload').draggable({
          drag: function(event, ui) {
              if (ui.position.top &gt; 0) {
                  ui.position.top = 0;
              }
              var maxtop = ui.helper.parent().height() - ui.helper.height();
              if ( ui.position.top &lt; maxtop) {
                  ui.position.top = maxtop;
              }
              if ( ui.position.left &gt; 0) {
                  ui.position.left = 0;
              }
              var maxleft = ui.helper.parent().width() - ui.helper.width();
              if ( ui.position.left &lt; maxleft) {
                  ui.position.left = maxleft;
              }
              ImageCropping.calculateCroppedCoordinates();
          }
      });
  </code></pre>