Khan
Khan

Reputation: 51

I want to drag and drop the image on canvas

I want to drag the image on canvas and it should be dragging again inside canvas when dropped i have done some work i have completed dragging of navbar and buttons and divs .I am attaching my fiddle please check, I tried lots of thing but could not find any solution to resolve this issue.

my fiddle

https://jsfiddle.net/Yousuf_007/d3tyrwp6/

Upvotes: 1

Views: 546

Answers (1)

Ram Segev
Ram Segev

Reputation: 2571

Wrap the img tag with div

<div class="fake tool button ">
<img src="https://www.w3schools.com/images/w3schools_green.jpg" alt="W3Schools.com" style="width:104px;height:142px;" class=" tool-1">
</div>

I updated your example here

EDIT:

If you don't want to wrap the img with div change

var handle = $("<div>", {
              class: "tool_handle ui-widget-header"
            })

to

var handle = $("<div>, <img>", {
              class: "tool_handle ui-widget-header"
            })

This is the updated jsFiddle

Upvotes: 1

Related Questions