2

onhover 打开一个弹出窗口,但仅当我单击页面的其余部分或关闭按钮时才会关闭

$('#promo').mouseover(function() {

        $('#promoarrow').show();

    });

    $('#closebtn').click(function() {

        $('#promoarrow').hide();

    });

这是小提琴:http: //jsfiddle.net/YFY5g/16/

4

1 回答 1

1

你想要这个吗??

$(document).click(function (e) {
    if (e.target)
        target = e.target;
    else if (e.srcElement)
        target = e.srcElement;
    else
        target = e.currentTarget;

    if (target.id != 'promoarrow') $('#promoarrow').hide(); 
});
于 2013-01-27T14:15:33.220 回答