我有一个非常简单的脚本,它使用jquery库,允许我用类"moveabledraggable“拖动和调整元素的大小。
$(".moveabledraggable").draggable({
stop: function(){
alert('dragging stopped');
}
}).resizable({
stop: function(){
alert('resizing stopped');
}
});它完美的工作,除了我希望“可移动拖动”固定在屏幕上作为一个用户卷轴。它需要使用“固定”定位。拖动元素不会改变我的硬编码内联样式
position: fixed;但是在调整元素的大小时,jquery将其更改为
position: relative;我怎么才能阻止这一切?不知道是否有可能,但是拖动和定位(这更难)并不能改变固定的位置,所以也许可以这样做。
小提琴手在这里!
(Jsfiddle实际上不起作用(可能是因为它如何在viewport中使用子窗口),但它可以复制粘贴到jquery-ui链接的本地文件。
发布于 2013-07-28 21:26:07
不知道为什么一开始我没有想到这个。只需像这样重新添加内联css:
$(".moveabledraggable").draggable({
stop: function(){
alert('dragging stopped');
}
}).resizable({
stop: function(){
alert('resizing stopped');
$(".moveabledraggable").css("position", "fixed");
}
});https://stackoverflow.com/questions/17912937
复制相似问题