1

プラグイン ascensor.js (http://kirkas.ch/ascensor/) を開発しました。完全に書き直した後 (scrollto プラグインを除外)、サイズ変更機能でバグが発生しました。

あなたがそれを行うと、いくつかのバウンス効果(クロム)があり、他のフロアの小さな部分を見ることができます.すべてのブラウザが異なるサイズ変更効果を持っていることは知っていますが、それを修正する方法があるかどうか疑問に思っています.

サイズ変更効果: Chrome/Safari/Firefox: 小さなバウンスと他のフロアを見る Opera: クリックするまでサイズ変更効果なし

完全なプラグインはこちら: http://kirkas.ch/ascensor/js/jquery.ascensor.js

そして、ここでサイズ変更関数に関する部分:

function resizeFloor(){
    var WW=$(window).width();
    var WH=$(window).height()

    if(params.Direction=='y'){$(node).stop().animate({scrollTop:(floor-1)*WH},1);}
    if(params.Direction=='x'){$(node).stop().animate({scrollLeft:(floor-1)*WW},1);}
    if(params.Direction=='chocolate'){
        var target = AscensorMap[StageOn-1].split('|');
        $(node).stop().animate({
        scrollLeft:(target[1]-1)*WW,
        scrollTop:(target[0]-1)*WH
        },1);
    }


    $(node).height(WH).width(WW).children(params.ChildType).each(function(){
        $(this).height(WH).width(WW);
    });

    if(params.Direction=='x'){
        $(node).children().css('position','absolute');
        $(node).children().each(function(index){$(this).css('left',index*WW);})
    }

    if(params.Direction=='chocolate'){
        $(node).children(params.ChildType).each(function(index){
            var CoordName = AscensorMap[index].split('|');
            $(this).css({'position':'absolute', 'left':(CoordName[1]-1)*WW, 'top':(CoordName[0]-1)*WH});
        });
    }
}

また、私は JS 開発の初心者なので、構文に関するアドバイスやシステムに関する批評があれば、私は完全にオープンです。

ありがとう

4

1 に答える 1

1

代わりに、自分で見つけて終了します

$(node).stop().animate({
    scrollLeft:(target[1]-1)*WW,
    scrollTop:(target[0]-1)*WH
},1);

私は使うべきです

$(node).stop().scrollTop((target[0]-1)*WH).scrollLeft((target[1]-1)*WW);
于 2012-09-17T16:24:24.207 に答える