Check out this JSFiddle I created: http://jsfiddle.net/o5tupLcb/.
I am facing an issue where the div element is not dragging as expected. Even when I try making $(".drag").draggable(); a standalone statement outside of the switch cases, it does not seem to work.
Below is the jQuery code snippet:
$(document).ready(function() {
$(".drag").mousedown(function(e) {
switch (e.which) {
case 1:
$(this).toggleClass("mousedown");
$(this).draggable(); /* Perhaps this should be placed differently */
case 2:
break;
case 3:
break;
default:
break;
}
});
$(".drag").mouseup(function(e) {
switch (e.which) {
case 1:
$(this).toggleClass("mousedown");
$(this).draggable(); /* Maybe repositioning this could help */
case 2:
break;
case 3:
break;
default:
break;
}
});
});
I have already attempted importing jQuery UI without success.
Edit: Upon further investigation, it appears that I was importing the wrong dependencies. Additionally, moving the draggable() function outside of the switch statements seems to enhance its functionality.