0

私はjquery uiのサイズ変更可能なハンドラーを持っていますが、これはWebアプリ内にあるため非常に遅くなる傾向があります。ゆっくり引っ張っても離しませんが、ハンドルから外れると「離して」引っ張るのをやめます。

$footer.resizable({ // Footer UI resize
    handles: 'n',
    maxHeight: footerHeight,
    minHeight: minFooterHeight - 5,
    stop: function () { // When user has stopped resizing

    $footer.css({ // reset footer width and top position
        'width': '100%',
        'top': 'auto'
    });

    $footerAndStatusbar.show();

    if ($(this).height() < minFooterHeight) { // if the height < #, hide it
        updateHeight(0, $footer);
        $footerAndStatusbar.hide();
    }

    updateHeight(); // update #mainWrap height
},
resize: function (event, ui) {
    $footerContent.height($(this).height() - 35);

    updateHeight(); // On footer resize, calculate and resize
}
}).css('height', Math.ceil((footerHeight + footerHeight / 2) / 2)); ;

$window.resize(function () { // Window resize
    updateHeight();
    editTooltip.tooltip('reposition');
});

$window (別名 $(window) ) のサイズ変更がピクセルをドラッグするたびにトリガーされていることに気付きました (理由はわかりませんが) パフォーマンスが大幅に低下します。基本的に、私の質問は、なぜウィンドウのサイズ変更を呼び出すのですか? 「手放す」とは

4

1 に答える 1

0

resizestopの代わりに使用してみてくださいresize:

resizestop: function (event, ui) {
    $footerContent.height($(this).height() - 35);

    updateHeight(); // On footer resize, calculate and resize
}

違いは、resizeドラッグ中にマウスが移動するたびに が呼び出されることです。関数の複雑さによっては、updateHeight()これは非常に遅くなる可能性があります。

resizestopサイズ変更が終了した後にのみ呼び出されます。クリック/ドラッグが終了します。

于 2012-04-30T14:10:10.713 に答える