开发者

Fading out everything except the element that's being pointed by the mouse

Sort of like a "Lightbox 2" effect but only on the elements pointed by a mouse. I don't even know how to start. Any advice would be awesome, than开发者_开发问答ks.


Like this:

$(function() {
    $('*').fadeTo('fast',0.5).hover(function() {
        $(this).fadeTo('fast',1);
    }, function() {
        $(this).fadeTo('fast',0.5);
    });
});

Demo: http://jsfiddle.net/Ender/vJQDx/


Have you seen the expose plugin? Might be exactly what you are looking for.


You asked how to fade out everything except the element that's being pointed by the mouse. Other answers here are showing how to fade in the hovered element, not fade out the non-hovered elements ...

Here is an answer that hits the point made in your question.

http://jsfiddle.net/g105b/ecJw8/

$(function() {
    $("img").mouseover(function() {
        $("img:not(:hover)").fadeTo("fast", 0.5);
    });
    $("img").mouseout(function() {
        $("img").fadeTo("fast", 1.0);
    });
});
0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜