English 中文(简体)
Jquery fade out all other elms on hover, do tade re in until mouse off all elms for a period
原标题:Jquery fade out all other elms on hover, don t fade back in until mouse off all elms for a period of time
  • 时间:2012-05-08 09:14:52
  •  标签:
  • jquery
  • fade

I ve got a page full of article s, withpher between them, summaryped in a <div id=“shell”>,并试图产生一种效应,如果你对所有其他条款加以控制的话。 这很简单,但当你从一条移至另一条时,其他一切都会fa倒或再次消失。 不要让所有条款退缩,而是留下<代码>#shell。 我只想回头来,当暴动发生时,不要把500米的物品放在一条上,因为炮弹横跨整个窗口。

$( article ).hover(function() {
    if ($( body ).hasClass( hover )) {
        $(this).fadeTo(100,1);
    }
    else {
        $( body ).addClass( hover );
        $( article ).not(this).fadeTo(300, 0.6);
    }
}, function() {
    $(this).fadeTo(300,0.6);
    checkandfade();
});

function checkandfade() {
    setTimeout(function() {
        $(document).mousemove(function(e){
            if (e.target.id ==  shell  && $( body ).hasClass( hover )){
                $( article ).stop(true,true).fadeTo(100, 1);
                $( body ).removeClass( hover );
            }
        });
    },500);
};

这正是我迄今为止所做的事,但我并不认为时间已到。 它偶尔会奏效,但大多会再次 rest。 我完全看着这种错误做法,或者说,我的法典是否只是一 gl一 gl? 如果你有任何想法或简单的解决办法,我会爱一些反馈。

跟踪我的可贵进展here

最佳回答

您:

var timeout = 0;
$( article ).hover(function() {
    $(this).stop(true, true).addClass( artHovered ).fadeTo(100,1);
    fadeOutArticles();
}, function() {
    $(this).removeClass( artHovered );
    fadeOutArticles();
});
function fadeOutArticles(){
    clearTimeout(timeout);
    $( article ).not( .artHovered ).fadeTo(300,0.6, function(){
        timeout = setTimeout(function(){
            if($( article.artHovered ).length==0){
                $( article ).stop(true,true).fadeTo(100, 1);
            }
        }, 500);
    });     
}
问题回答




相关问题
getGridParam is not a function

The HTML: <a href="javascript:void(0)" id="m1">Get Selected id s</a> The Function: jQuery("#m1").click( function() { var s; s = jQuery("#list4").getGridParam( selarrrow )...

selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

jQuery cycle page with links

I am using the cycle plugin with pager functionality like this : $j( #homebox ) .cycle({ fx: fade , speed: fast , timeout: 9000, pager: #home-thumbs , ...

jquery ui dialog opens only once

I have a button that opens a dialog when clicked. The dialog displays a div that was hidden After I close the dialog by clicking the X icon, the dialog can t be opened again.

jConfirm with this existing code

I need help to use jConfirm with this existing code (php & Jquery & jAlert). function logout() { if (confirm("Do you really want to logout?")) window.location.href = "logout.php"; } ...

Wrap text after particular symbol with jQuery

What I m trying to do, is wrap text into div inside ll tag. It wouldn t be a problem, but I need to wrap text that appears particularly after "-" (minus) including "minus" itself. This is my html: &...

热门标签