Home > Enterprise >  Make jQuery UI Draggable Cursor centered in Bootstrap Modal when dragging
Make jQuery UI Draggable Cursor centered in Bootstrap Modal when dragging

Time:12-16

Say you have a basic Bootstrap Modal

And you try to make it draggable using jQuery UI.

You can simply do, this $('#myModal').draggable()

This works great, however I've noticed the speed of the cursor can be a lot faster than how the speed of the modal's dragging. This can result in the cursor being far ahead of the actual modal and things looking wonky.

Here's an example of what I mean https://jsfiddle.net/dzmqg8ub/3/

Any solutions to this?

Thanks!

CodePudding user response:

This should work!

the "lagg" your experiencing is because of

<div 

by removing modal-dialog and inserting modal-dialog in 1 div above that

<div  id="modal-sm" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true" >

it solves your issue!

here is a demo

  • Related