且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

jQuery UI可调整大小的快照

更新时间:2022-12-26 22:52:54

确定成功了.只需将元素的宽度设置为200.它的公差为15px,因此,如果元素在185和215px之间,它将捕捉到200px.

Ok got it working. Simply set the width of the element to 200. It has a tolerance of 15px so if the element is between 185 and 215px it will snap to 200px.

$("#left").resizable({
minWidth: 60,
handles: "e",
resize: function (event, ui) {
    if(Math.abs(200 - ui.size.width) <= 15){
        $("#left").css("width", 200);
    }
}