jQuery Masonry conflict with jQuery UI Sortable

感情迁移 提交于 2019-12-19 04:46:04

问题


jQuery UI Sortable is not working when using Masonry. Any idea how to avoid this conflict? Any help would be appreciated.


回答1:


I think i had a similar problem.

I managed to fix it by simply recalling masonry within the code for setting up the sortable elements. (there might be a better way, i'm not sure?)

$(function() {
        $("#youritem").sortable({ opacity: 0.9, cursor: 'move', update: function() {
            var order = $(this).sortable("serialize") + '&action=updateRecordsListings'; 
            $.post("dosomething.php", order, function(theResponse){
                       //you can see that i've re-called masonry once the sortable object has been moved                
                        $('#youritem').masonry({columnWidth: 200, itemSelector: 'youritem' });
            });                                                              
        }                                 
        });
    });

Hopefully that helps you out – if there is another way i'd also like to know.




回答2:


I also had similar problem, but then i found a working Masonry&Sortable&resizable example:

http://tyler-designs.com/masonry-ui/

Not perfect, but it's a good starting point.




回答3:


Use gridster — it works like a charm and very intuitive



来源:https://stackoverflow.com/questions/5141082/jquery-masonry-conflict-with-jquery-ui-sortable

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!