开发者

jQuery Menu Hover, but don't at click

HTML Structure:

<a class="fadeThis"  id="paperoff" href="#"><span id="paperon" class="hover">News</span></a>

JAVASCRIPT:

$('.fadeThis > .hover').empty();    

$('.fadeThis').each(function 开发者_如何转开发() {
    var text = $(this).text();
    $(this).append(''+text+'');

    var $span = $('> span.hover', this).css('opacity', 0);  
    $(this).hover(function () {
        $span.stop().fadeTo(500, 1);
    }, function () {    
        $span.stop().fadeTo(500, 0);
    }).click (function () {
        // HERE SOMETHING THAT TELLS TO NOT FADE BACK THE SPAN (ONLY FOR THE CLICKED DIV).
});

});


Your question is not very clear, but do you want someting like this?

var fadeBlock = false;
$(this).hover(function () {
$span.stop().fadeTo(500, 1);
}, function () {
    if (!fadeBlock) {
      $span.stop().fadeTo(500, 0);
} else { fadeBlock = false;}
}).click (function () {
   fadeBlock = true;
});
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜