1

こんにちは私はJqueryFlipプラグインを使用しています-http: //lab.smashup.it/flip/

ホバー時にフリップを実行するこのコードがあります。マウス入力すると、「。container」が裏側にあります。マウスを離れると、「。container」が前面に表示されます。

mouseenterフリップアニメーションが終了する前にマウスが「.container」を離れると、「。container」は前面に戻りません。これが起こったら、フリップを止める必要があります。どうすればこれを達成できますか?'stop(true、false)'のように使用するのでしょうか、それとも'if($(this).is( ":animated")){}...'または'var hovering = 0; $( "。container")。hover(function(){hovering = 1;}、function(){hovering = 0;}); .. etc '

助けてください。ありがとう。

$('.container').bind("mouseenter", function() {
    var elem = $(this);
    if (elem.data('flipped')) {} else {
        elem.flip({
            direction: 'lr',
            speed: 500,
            onBefore: function() {
                elem.html(elem.siblings('.content').html());
            },
            onAnimation: function() {
                elem.data('flipped', true);
            },
            onEnd: function() {}
        });
    }
});
$('.container').bind("mouseleave", function() {
    var elem = $(this);
    if (elem.data('flipped')) {
        elem.flip({
            direction: 'rl',
            speed: 500,
            onBefore: function() {
                elem.html(elem.siblings('.initContent ').html());
            },
            onAnimation: function() {
                elem.data('flipped', false);
            },
            onEnd: function() {}
        });
    }
});​
4

1 に答える 1

1

こんにちは、気にしないで、ホバーされていない他のdivを非表示にするという、少し異なる解決策を思いつきました。私の質問を読んでくれた人に感謝します。

  $(".container").each(function(i){
        $(".container").not($(this)).mouseenter(function() {
        $(".container").eq(i).trigger("mouseleave",[true]);
        });
  });
于 2012-10-09T10:09:21.860 に答える