0

寻求解决我的问题...

我使用此脚本在此处的另一个线程中部分找到了答案

$(function () {
$(".myclass").hover(function ()
{}, function ()
{
    $(".myclass>li").fadeTo(200, 1)
});
$(".myclass>li").hoverIntent(function ()
{
    $(this).attr("id", "current");
    $(this).siblings().fadeTo(200, .6);
    $(this).fadeTo(300, 1)
}, function ()
{
    $(".myclass>li").removeAttr("id");
    $(this).fadeTo(200, 1)
})})

当列表中的一个项目悬停时,脚本会淡出所有其他项目。原始演示在这里http://jsbin.com/usobe

这在我的网站上工作正常,尽管列表(缩略图网格)是更大滑块脚本的一部分,它通过 ajax 加载“预览”。单击列表项时,隐藏部分会在页面上展开,滑块脚本会为列表项分配“活动”类。

当隐藏部分打开时,我希望激活的缩略图保持 1 不透明度,而其余部分淡化为 0.6,与使用上述脚本的悬停效果完全相同。当您单击缩略图以激活 ajax 脚本时,我想要实现的目标变得显而易见。是否可以使用active该类来实现这一点,即如果类未active设置为 .6 不透明度?

提前致谢

- - 编辑

感谢大家的建议-到目前为止我运气不佳!使用上面的代码,是否可以对其进行修改,以便在单击列表项时保持指定的不透明度级别?我想那会很好。然后我可以使用onclickI guess 在隐藏的 div 关闭时将所有项目淡化为完全不透明。

4

2 回答 2

1

我试图猜测您的代码是如何工作的,据我所知,您应该这样做:

// this is the selector that gets the click on the thumbnail
$('li.item').click(function() {
    // fade all the thumbnails to op 1.0
    $('#li.item').css('opacity', '.6');
    // let the active thumbnail to 1.0
    $(this).css('opacity', 1);

    //show your hidden div
});

然后,当您关闭隐藏的 div 时:

$('div#hiddenDiv').onClose(function()
    // about to close
    $(this).fadeTo('fast', 1);
});
于 2012-05-18T20:24:12.873 回答
0

您可以使用针对 zetaThumbs li 元素的点击,将当前目标设置为 1 并将其兄弟设置为 .6

 $('.zetaThumbs li').click(function(){
    $(this).css({'opacity':1}).siblings().css({'opacity':.6});
 })
于 2012-05-18T20:16:36.830 回答