Position: Fixed Draggable

58 views
Skip to first unread message

Ryan Cebulko

unread,
May 7, 2014, 9:09:40 AM5/7/14
to threed...@googlegroups.com
I found that it was annoying to have the draggable windows I'd been creating scroll with the page. In my particular use case, it was far better to have them fixed on the page, however setting this CSS property causes offset issues if you try to drag a div after scrolling down the page somewhat. This can be fixed by providing a boolean option, such as noScroll. In the init method, store clientX and clientY in dd along with pageX and pageY (lines 126 and 127). On lines 317 and 318, if noScroll is true, it should become obj.offsetX = obj.originalX + obj.deltaX + dd.clientX - dd.pageX; and the appropriate analog for Y. I patched my version of the library; if you add it, it would be a useful and easy change.
Reply all
Reply to author
Forward
0 new messages