当 IE 8 中的尺寸更改(高度、宽度)时,VML 中的可拖动元素会卡住

发布于 2025-01-08 05:19:57 字数 531 浏览 5 评论 0 原文

我遇到了 VML 问题(我将其用作 svg 的后备),

我使用 jQuery UI 可拖动来让用户能够移动元素。当我通过更改高度和宽度的样式属性来调整图像(即 av:image)大小时,就会出现问题。

此时发生的情况是,元素卡在其容器的左上角并且无法再拖动。

奇怪的是,当我在 JavaScript 控制台中询问可拖动元素的位置(顶部、左侧)时,我得到了值,并且当我单击和拖动时这些值会发生变化 - 即使该元素在视觉上没有移动。 ?

有人遇到过这个问题吗

这是我更改元素大小的地方。

$($image)
    .css({
        'width' : zoomInPx_width + "px",
        'height' : zoomInPx_height + "px"
    });

可拖动设置非常简单

$($image).draggable({
    drag: function () { /*callback here*/ }
})

I'm having issue with VML (which I use as fallback for svg)

I use jQuery UI draggable to let user be able to move an element around. The problem occurs when I resize the image (which is a v:image) by changing the style attribute of height and width.

What happen at this point is that the element get stuck at the left top corner of it's container and cannot be dragged anymore.

A strange thing is that when I ask for the position (top, left) of the draggable element in the JavaScript console, I get value, and those values change when I click and drag - even though the element isn't visually moving...

Anyone run into this problem before?

Here's where I change then size of my element.

$($image)
    .css({
        'width' : zoomInPx_width + "px",
        'height' : zoomInPx_height + "px"
    });

The draggable is set pretty straight forward

$($image).draggable({
    drag: function () { /*callback here*/ }
})

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

只有影子陪我不离不弃 2025-01-15 05:19:57

最后我成功地完成了这项工作。

当我们更改可拖动元素的大小时,VML 在 IE 8 上似乎会崩溃。因此,当滑动发生时,我必须销毁该元素并从头开始重新创建它......

这并不是真正的高性能,但这是对我来说唯一有效的修复方法。

顺便说一句, .detach() 不起作用,您必须销毁它并从头开始重新创建它。

您也可以在那里获取一些信息: http://www.acumen-corp.com/Blog/tabid/298/EntryId/26/Using-jqueryRotate-ui-draggable-and-ressized-images-in-IE7-IE8-and-任何其他浏览器.aspx

Finaly I manage to make this work.

Seems that VML crash on IE 8 when we change size of a draggable element. So, I had to destroy the element and recreate it from scratch when sliding occurs...

That's not really performant, but that's the only fix to work for me up here.

By the way, .detach() didn't work, you have to destroy it and recreate it from scratch.

You can get some info there too: http://www.acumen-corp.com/Blog/tabid/298/EntryId/26/Using-jqueryRotate-ui-draggable-and-resizable-images-in-IE7-IE8-and-any-other-browser.aspx

鹿童谣 2025-01-15 05:19:57

在我的应用程序中我使用了以下代码:

var $cloned_image = $($image).clone().get(0);
$($image).remove();

// need add draggable again
$($cloned_image).draggable();

document.getElementById('k').appendChild($cloned_image);
$image = $cloned_image;

on my application I used this code:

var $cloned_image = $($image).clone().get(0);
$($image).remove();

// need add draggable again
$($cloned_image).draggable();

document.getElementById('k').appendChild($cloned_image);
$image = $cloned_image;
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文