2012-04-30 39 views
0

私はjQuery UIリサイズ可能ハンドラを持っています。それをゆっくりとドラッグすることは可能ですが、手放すことはありませんが、ハンドルから離れるとドラッグしてドラッグを中止します。私は$窓(別名$(ウィンドウ))ことに気づきJQueryUI - ドラッグするとサイズ変更可能なハンドルが移動します

$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'); 
}); 

サイズを変更するには、巨大なパフォーマンスカットを引き起こして(私がなぜわからないが)、ドラッグ画素ごとにトリガされています。基本的に、私の質問は、なぜそれはウィンドウのサイズを呼び出すことですか?いただきました「せに行く」と

+0

フッタのresize "resize"メソッドと "stop"メソッドの中のいくつかのfn呼び出しをコメントアウトしました。まだかなりスケッチです。 – iRedMedia

答えて

0

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

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

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

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

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

+0

私は「ストップ:」と思ったのですか? – iRedMedia

関連する問題