1

サイズ変更可能な要素が2つあり、グリッドを同期的に維持してサイズを変更する必要があります。これら 2 つのオプションは一緒には機能しないようです。何か案は?

デモ: http://jsfiddle.net/CbYtT/2/ (水平方向のサイズ変更を試してください)

$(function() {

    $( "#this" ).resizable({
        alsoResize: "#that", 
        grid: 100

    });

    $( "#that" ).resizable({
        alsoResize: "#this", 
        grid: 100
    });

});
4

2 に答える 2

5

きれいではありませんが、機能します。

    $( "#this" ).resizable({
        handles: "e",
        resize: function(event, ui) {
            $( "#that" ).width($(this).width());
            $( "#that" ).height($(this).height());
        },
        stop: function(event, ui) {
            $( "#that" ).width($(this).width());
            $( "#that" ).height($(this).height());
        },
        grid: 100
    });

    $( "#that" ).resizable({
        handles: "e",
        resize: function(event, ui) {
            $( "#this" ).width($(this).width());
            $( "#this" ).height($(this).height());
        },
        stop: function(event, ui) {
            $( "#this" ).width($(this).width());
            $( "#this" ).height($(this).height());
        },
        grid: 100
    });

JSフィドルの作業バージョン

http://jsfiddle.net/Robodude/CbYtT/3/

于 2012-08-27T17:46:31.163 に答える