JQuery 可拖动事件在 IE9 中不起作用

标签 jquery internet-explorer

以下代码在除 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/

相关文章:

c# - 使用 jquery ajax 调用 C# webmethod 省略可选参数

jquery - flexbox 的 slideDown 动画

jquery - 使用 jquery 使用父元素的属性设置子元素 attr

jquery - :hover on span in button not working in IE

JavaScript IE 错误 : unexpected call to method or property access

internet-explorer - 自定义 SVG 标记不会在 IE 11 中显示

javascript - 普通 Javascript 对象上的 jQuery.bind() 事件

Javascript - 显示文本区域的剩余字符

javascript - 带有 Express 服务器的 create-react-app 未在 IE 中呈现

html - 为什么 css 网格在 IE 和 Edge 中不起作用?