About dragging and dropping in jquery

Asked 2 years ago, Updated 2 years ago, 40 views

I am currently trying to drag and drop images using jquery in monaca, but it doesn't work.
Load jquery in header

jQuery("#hogeDrag").draggable();

I'm doing this, but I can't
By the way, it doesn't work even if it's not an image
Is it related to the screen not fixed?
Thank you.
Header

<script src="js/jquery 2.1.3.min.js"></script>
<script src="js/jquery.ui.min.js">/script>

html

<divid="draggable" class="ui-wide-content">
  <p>Drag me around</p>
</div>

js

$(function(){
    $("#draggable").draggable();
  });

css

#draggable {width:150px;height:150px;padding:0.5em;}

Thank you for your cooperation.

jquery

2022-09-29 22:56

1 Answers

draggable() is the jQuery UI method.
The jQuery UI must also be loaded.

$(function(){
    $('#draggable').draggable();
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<script src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/jquery-ui.min.js"></script>
<link rel="stylesheet" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.11.2/themes/smoothness/jquery-ui.css"/>

<divid="draggable" style="width:100px;height:100px;background:#eeddcc;">
    <p>dragme</p>
</div>


2022-09-29 22:56

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.