2012-12-02 51 views
0

嘿,我正在盡我所能找到一種方式,當用鼠標懸停時,將其他選項調暗並放大(提前)懸停物品鼠標正在打開。jQuery突出顯示/縮放懸停物品和朦朧其他

我的代碼可以在這裏找到>Code link

我有沒有選擇的工作就好了衰落的項目...只需要在懸停項目的縮放幫助!

代碼中,我目前擁有的變焦效果是可怕的,不會在所有的工作....

$('.category-container').bind('mouseover',function() { 
    $(this).addClass('hover').stop(true,true); 
    $('.category-container').not('.hover').stop(true,true).fadeTo('fast',0.2).animate({ 
    width: '2em', 
    height: '2em', 
}, 200); 

}); 
$('.category-container').bind('mouseout',function() { 
    $('.category-container').removeClass('hover').stop(true,true).fadeTo('fast',1); 
});​ 

任何幫助將是巨大的!

UPDATE

我得到了它,我想效果工作...只是似乎並不在項目褪色,如果你動過彼此不首先讓列表淡入第一:new code

+0

當你說「縮放」,你的意思是讓大?你不能只添加$('。hover')。animate({width:// whatever}); – Adam

+0

是的,讓它脫穎而出。 – StealthRT

+0

ol會有一些li元素不是 – Popnoodles

回答

1

更改您的mouseover代碼中的最後一行以淡出所有元素,但隨後將它跟隨元素的fadeTo進行跟蹤。你的代碼是弄不清正在上空盤旋什麼元素,所以最好是明確使用$(this)

$('.category-container').bind('mouseover',function() { 
    $(this).addClass('hover').stop(true,true).animate({ 
     fontSize: '26px', 
    }, 200); 
    // This line changed 
    $('.category-container').stop(true,true).fadeTo('fast',0.2); 
    // This line added 
    $(this).fadeTo('fast',1);  
}); 

$('.category-container').bind('mouseleave', function() { 
    $('.category-container').removeClass('hover').stop(true,true).animate({ 
     fontSize: '12px', 
    }, 200).fadeTo('fast',1); 
}); 
​ 
+0

工作得很好!謝謝! – StealthRT