以下代码在除 Internet Explorer 9 之外的任何浏览器中都可以正常运行;
$(".dragbox").draggable({
handle: ".header",
grid: [1, 1],
containment: 'parent',
reflow: true,
stop: function(event, ui) {
//do not update the widgets pos/size not even by accident when we are in forced rearrange mode
if (jQuery('#widget_content').hasClass('floating-dashboard-widgets'))
return false;
var id = ui.helper.context.id.split('_')[1];
$.ajax({
type: "POST",
url: "<?php echo Yii::app()->baseUrl . '/user/dbview/update/id/'; ?>" + id,
data: {data: {left: ui.position.left, top: ui.position.top, parent_width: get_parent_width(), parent_height: get_parent_height()}},
success: function(data) {
if (data.status == 'true') {
}
},
dataType: 'json',
});
}
});
我有多个可拖动元素,但无法按照 IE9 的要求将它们从 div
标记更改为 a
标记;
正如我所读到的,我还必须使用这样的东西:
$('#demo1_box')
.bind('drag',function( event ){
$( this ).css({
top: event.offsetY,
left: event.offsetX
});
});
但是这个bind方法没有任何包含元素;
对于这种情况我有什么解决方案?
最佳答案
我必须使用 jslate 开发一个应用程序;
我重新检查了用于可拖动元素的 html 代码,我注意到我的代码中缺少 div
元素;
在我完成 html 代码后,愚弄 jslate 模式,它就像魔术一样工作;
关于JQuery 可拖动事件在 IE9 中不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21134836/