#3549 closed bug (wontfix)
Toggling draggable grid values with data() causes unexpected change in grid
Reported by: | robin | Owned by: | paul |
---|---|---|---|
Priority: | minor | Milestone: | 1.6 |
Component: | ui.draggable | Version: | 1.6rc2 |
Keywords: | Cc: | ||
Blocked by: | Blocking: |
Description
<script src="../media/js/jquery.js" type="text/javascript"></script> <script src="../media/js/ui.core.min.js" type="text/javascript"></script> <script src="../media/js/ui.draggable.js" type="text/javascript"></script> <style> #outer{ height:50px; width:100px; background:#ddddff; } #inner{ height:50px; width:50px; background:#44ff44; } </style> <div id="outer"> <div id="inner"></div> </div> <a href="#">change grid<a> <script> $(document).ready(function(){ $('#inner').draggable({ distance:0, containment:'#outer', grid:[1,50], stop:function(){ console.log($('#inner').css('left')) //for firebug } }) $('a').toggle( function(){ $('#inner').data('grid.draggable',[10,50]) }, function(){ $('#inner').data('grid.draggable',[1,50]) } ) }) </script>
Drag and release the green box to the right bit by bit 3 times.
eg.
by default the grid is 1px on the x-axis.
- Drag box to the right, console says 3px
- Drag box to the right again, console says 4px
- Drag box to the right again, console says 6px
- Click 'change grid', and the x-axis grid becomes 10px
- Click box, and the console says 14px
The result gets the previous position (4px) plus the current grid x value (10px). I believe this outcome is not very useful.
I would have expected 16px
OR
A strict 20px since the grid has changed to 10px increments.
Change History (3)
comment:1 Changed 14 years ago by
Milestone: | TBD → 1.next |
---|
comment:2 Changed 12 years ago by
Resolution: | → wontfix |
---|---|
Status: | new → closed |
comment:3 Changed 10 years ago by
Milestone: | 1.next → 1.6 |
---|
Note: See
TracTickets for help on using
tickets.
The grid option should be removed during the rewrite. It can be re-implemented as an extension.