1

以下は、フッター バナーを表示および非表示にするために使用されるコードです。MouseOver 以外はすべて正常に動作しています。

MouseOver は機能しますが (トリガーされると、その領域にハイライトが表示されます)、ユーザーがその領域をクリックすると、ハイライトは消えますが、ユーザーがその領域を出ると、出口をクリックした後、再度トリガーされるとハイライトが点滅します。

したがって、同じ領域をクリックすると、mouseenter/mouseleave コードがリセットされるようです。

クリックした後でも、このイベントのトリガーを再び防ぐにはどうすればよいですか? ありがとうございました。

// Hide the Footer
$(document).on('click','div#fixedPageFooterShown', function() {hideFooterBanner();});


// Highlight Footer MouseOver
$(document).on('mouseenter','div.fixedPageFooterDisplay', function() {
        $('img.bannerBottomMouseOver').show();
    }).on('mouseleave','div.fixedPageFooterDisplay', function () {
        $('img.bannerBottomMouseOver').hide();
});


// Hide Footer Banner Function
function hideFooterBanner() {
    $('div#fixedPageFooter').fadeOut('fast', function () {
        $('div#fixedPageFooterClosed').fadeIn('fast');
        $('img.bannerBottomMouseOver').fadeOut('fast');
        $('img#footerArrowMin').hide();
        $('img#footerArrowMax').show();
    });
}


// Show Footer Banner Function
$(document).on('click','div#fixedPageFooterClosed', function() {
    $(this).fadeOut('fast', function () {
        $('div#fixedPageFooter').fadeIn('fast');
        $('img.bannerBottomMouseOver').fadeOut('fast');
        $('img#footerArrowMax').hide();
        $('img#footerArrowMin').show();
    });
});
4

1 に答える 1

0

何がうまくいかないのかわかりません.htmlレイアウトを表示するとさらに役立ちます

event.preventdefault()デフォルトのイベントを防ぐために使用できると思います :

// Hide the Footer


// Highlight Footer MouseOver
//i'll change here to be more jquery'ish - not need on() i think as it replacemement for live()

$('div.fixedPageFooterDisplay').bind('mouseenter', function() {
    $('img.bannerBottomMouseOver').show();
}).bind('mouseleave', function() {
    $('img.bannerBottomMouseOver').hide();
});


// Hide Footer Banner Function
var hideFooterBanner = function(event) {
    //prevent default event handler
    if (event !== undefined) {
        event.preventdefault();
    }

    $('div#fixedPageFooter').fadeOut('fast', function() {
        $('div#fixedPageFooterClosed').fadeIn('fast');
        $('img.bannerBottomMouseOver').fadeOut('fast');
        $('img#footerArrowMin').hide();
        $('img#footerArrowMax').show();
    });
};

//i'll change here to be more jquery'ish
$('div#fixedPageFooterShown').click(hideFooterBanner);


// Show Footer Banner Function
//i'll change here to be more jquery'ish
$('div#fixedPageFooterClosed').click(function(event) {

    //prevent default event handler     
    event.preventdefault();

    $(this).fadeOut('fast', function() {
        $('div#fixedPageFooter').fadeIn('fast');
        $('img.bannerBottomMouseOver').fadeOut('fast');
        $('img#footerArrowMax').hide();
        $('img#footerArrowMin').show();
    });
});​
于 2012-10-13T02:51:57.140 に答える