Ticket #2870 (closed bug: invalid)
Draggables no longer work after refreshing the parent's parent
| Reported by: | estel | Owned by: | paul |
|---|---|---|---|
| Priority: | minor | Milestone: | 1.2.4 |
| Component: | ui | Version: | 1.2.3 |
| Keywords: | Cc: | ||
| Blocking: | Blocked by: |
Description
I have an application divided into sections where each section is dynamically refreshed (via $.get). The Problem i am running into is when my page loads, I have a draggable div in one section. I refresh only that section, and recieve the same content two things happen. First the div goes back to the starting location of 0,0 as I would expect. But the second thing is that the div is no logger draggable. If I refresh the whole page, I can drag it again. The code that is being refreshed is below. If there is something stupid I am doing wrong, I'm sorry to waste your time. Thanks for any help.
<div style='height: 800px; border: 1px solid red'>
<div id='example1' style='background: #E6F7D4; width: 500px; height: 300px; >
<div>Drag Me!</div>
</div>
</div> <script type="text/javascript">
$('#example1').draggable({literal}{ containment: 'parent' }{/literal});
</script>
Change History
comment:1 Changed 5 years ago by scott.gonzal
- Status changed from new to closed
- Resolution set to invalid
comment:2 Changed 5 years ago by scott.gonzal
There's more info in the FAQ.
Please follow the bug reporting guidlines and use jsFiddle when providing test cases and demonstrations instead of pasting the code in the ticket.

When you "refresh" the content, you're removing the element that is draggable and creating a new element. You need to re-initialize everything that you just replaced or use the livequery plugin.