2012-12-30 30 views
2

我使用css和jquery懸停模糊效果。當您將鼠標懸停在其中一段文本上時,css的某些部分將應用於使用jquery的兄弟。如果您查看link,「音樂」文本沒有超鏈接,並且在播放時採取了我想要的操作方式。但其餘的都是鏈接的,我希望它們在超鏈接時表現得像「音樂」。你如何使鏈接文本作爲正常文本行事?

CSS:

.blur { 
text-decoration: none; 
color: #339; 
-webkit-transition: 400ms ease 100ms; 
-moz-transition: 400ms ease 100ms; 
transition: 400ms ease 100ms; 

} 

.textshadow { 
text-decoration: none; 
color: rgba(0,0,0,0); 
outline: 0 none; 
-webkit-transition: 400ms ease 100ms; 
-moz-transition: 400ms ease 100ms; 
transition: 400ms ease 100ms; } 
.out { 
text-shadow: 0 0 4px #339;} 


a:link { 
text-decoration: none; 
} 
a:visited { 
text-decoration: none; 
} 
a:hover { 
text-decoration: none; 
} 
a:active { 
text-decoration: none; 
opacity:none; 
} 
+0

同樣的,你可以改變'音樂'到'Music',你不可以嗎? – tehsockz

+0

定義「行爲像」。不知道爲什麼你不能只爲'th'寫''th'相同的css規則。 – charlietfl

+0

爲你的問題製作了一個[fiddle](http://jsfiddle.net/xK8nq/)。 –

回答

2
$('.blur').hover(function() { 
    $(this).siblings().children().addClass('out textshadow'); 
}, function() { 
    $(this).siblings().children().removeClass('out textshadow'); 
}); 

Fiddle - 所有文本超鏈接。


或者你可以保持相同的JS(不.children())和編輯CSS選擇器:如果你希望他們所有

.blur.blur a
.textshadow.textshadow a

Fiddle

+0

現在它的作品謝謝! – maxmitch

+0

這太奇怪了。我試圖改變CSS,但它不起作用! – maxmitch

+1

如果使用CSS之一,確保將JS恢復到不帶'.children'的版本。否則,JS一樣也會很好。 '=]' –

相關問題