我這行的CSS的形象,我會淡入在懸停:如何使背景圖片的jQuery淡入
#social-links a:hover span { background: url("/images/hover-light.jpg") no-repeat scroll -4px 42px transparent; }
它的工作原理,現在我想從jQuery的效果添加淡入到它。有多個spans
,所以我假設我將不得不標識this
,但我沒有在一段時間內使用jquery並且不記得。
我這行的CSS的形象,我會淡入在懸停:如何使背景圖片的jQuery淡入
#social-links a:hover span { background: url("/images/hover-light.jpg") no-repeat scroll -4px 42px transparent; }
它的工作原理,現在我想從jQuery的效果添加淡入到它。有多個spans
,所以我假設我將不得不標識this
,但我沒有在一段時間內使用jquery並且不記得。
$('#social-links a').mouseleave(
function() {
$(this) // anchor tag from which mouseleave happen
.find('span')
.css({ 'background': 'your background css' })
});
對於fadeIn()
你可以這樣做:
$('#social-links a').mouseleave(
function() {
$(this) // anchor tag from which mouseleave happen
.find('span')
.fadeIn();
});
這裏有一個背景圖像褪色的一個很好的例子。幾乎沒有修改,它是完美的你的目的。
http://www.jasperrooswinkel.com/smooth-fullscreen-background-slideshow-in-jquery/
謝謝你,所以這樣做後,我加入.fade()函數aroung名爲.css()函數? – 2012-07-14 11:18:41
@NilsR檢查我的更新 – thecodeparadox 2012-07-14 11:30:02
感謝@thecodeparadox,但我嘗試了他們兩個。第一個與我的CSS輸入到它,然後最後一個,他們都沒有工作。我甚至不認爲標識符/定位器標識符找到一些奇怪的原因的元素... – 2012-07-14 11:39:16