我遇到了 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*/ }
})
发布评论
评论(2)
最后我成功地完成了这项工作。
当我们更改可拖动元素的大小时,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
在我的应用程序中我使用了以下代码:
on my application I used this code: