【问题标题】:jQuery fading links except those that are images?jQuery淡化链接除了那些是图像?
【发布时间】:2011-10-19 12:33:13
【问题描述】:

我用 jQuery 编写了一个非常简单的脚本。这个想法是淡化所有不透明的链接除了链接是图像。

这是我的代码:

$('#content_wrapper a, #footer_wrapper a, .dcmenu_market_link a').not('a img').each(function() {
    $(this).css("opacity", "0.6");
    $(this).hover(function() {
        $(this).addClass('fade');
        $(this).stop().animate({ opacity: 1.0 }, 600);
    },
    function() {
        $(this).stop().animate({ opacity: 0.6 }, 600);
        $(this).removeClass('fade');
    });         
});

【问题讨论】:

    标签: jquery image fading


    【解决方案1】:

    这应该让你得到所有非图片包含的链接 -

    $('a:not(:has(img))')
    

    【讨论】:

    • 太棒了!很高兴它有帮助。如果有帮助,请不要忘记接受答案。谢谢:)
    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-05-16
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多