开发者

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

开发者 https://www.devze.com 2023-01-30 08:06 出处:网络
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:

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

精彩评论

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