朋友们,我想知道我是否可以使用jquery draggable插件来更新margin-left和margin-top属性,默认情况下它会更新拖动事件中css的左侧和顶部属性。 请帮忙
答案 0 :(得分:1)
当然可以
$( "#box" ).draggable({
stop: function( event, ui ) {
$( "#box" ).css('margin-top',$("#box").offset().top).css('top',0);
$( "#box" ).css('margin-left',$("#box").offset().left).css('left',0);
}
});