Dragging the image with the mouse inside the block – jquery-ui

With the help of the jQuery-ui library, we will implement a useful task – dragging an image with the mouse inside a block (or another block). Draggable in principle the standard function of jquery-ui-setting up of realization with full filling of the image to be reduced to the correct instruction of styles and some settings of the script of processing.

Further marking:

Styles:

And the script processing:

  Well, the result of all vysheperechislennyh action - you can now move the image (the div) inside another block with the filling:

And of course nobody bothers to experiment with styles to fit them under the sizes of the pictures. The workability of the code is not in doubt-the result can be seen directly on the page.

Leave a Reply

Your email address will not be published. Required fields are marked *