jquery drag image

前端 未结 5 442
感动是毒
感动是毒 2021-01-11 19:17

i want to make a draggable image in jquery. first of all my experience with jquery is 0. having said that let me describe what i want to achieve. i have fixed width/height

5条回答
  •  我在风中等你
    2021-01-11 19:55

    $('#dragMe').draggable({ containment: 'body' });
    

    This code will make it posible to drag the div with the ID of dragMe where ever you want inside the body of the document. You can also write a class or id as containment.

    $('#dragMe').draggable({ containment: '#container' });
    

    This code will make the div dragMe able to be draggable inside of the id container.

    Hope this helps otherwise you should be able to find your answer here http://jqueryui.com/demos/draggable/

提交回复
热议问题