Flyer53 / jsPanel

A jQuery Plugin to create highly configurable floating panels, modals, tooltips and hints/notifiers for use in a backend solution and other web applications.
http://v2.jspanel.de/
Other
163 stars 56 forks source link

Prevent dragging off page? #31

Closed Jakobud closed 9 years ago

Jakobud commented 9 years ago

If you grab a panel and drag it, it is possible to drag it off the side of the page so that the page scrolls to following it, even if you have overflow-x hidden. Can you prevent the panels from being dragged off the page?

Flyer53 commented 9 years ago

Use option.draggable with containment set to "window"

$.jsPanel({
    draggable: {
        containment: "window"
    }
});

For more details see http://api.jqueryui.com/draggable/#option-containment