1
我正在创建一个web应用程序,它允许用户通过在工作区内调整大小和移动它们来操纵图像。目前我通过使用jQuery UI的Draggable和Resizable小部件来实现这一点。每当用户将新图像添加到工作区时,我都会重新运行以下代码,如果有更有效的方法来做到这一点,我很想知道。使用多个小部件时jQuery UI性能问题
layers.draggable({
containment: '#sig_workarea',
stop: function (event, ui) {
var id = wizard.findLayer(ui.helper.attr("id"));
if (id) {
wizard.layers[id].x = ui.position.left;
wizard.layers[id].y = ui.position.top;
wizard.history.setPoint();
}
}
});
images.resizable({
aspectRatio: true,
containment: "#sig_workarea",
handles: 'se',
stop: function (event, ui) {
var id = wizard.findLayer(ui.helper.attr("id"));
if (id) {
wizard.layers[id].height = ui.size.height;
wizard.layers[id].width = ui.size.width;
wizard.history.setPoint();
}
}
});
我遇到的问题是应用程序运行缓慢,移动图像时移动不是很平滑。我的问题是,是否有任何方法可以处理大约10-15个可拖动和可调整大小的小部件,从而提供最佳性能?
如果我遗漏了任何信息或者您需要关于我的实施的更多详细信息,请直接询问。
在此先感谢 丹尼尔
嗨,感谢您的回复。 –