0
我正在爲客戶端的網站設置一個啓動頁面。jQuery div寬度動畫不會流暢動畫
這個想法是,藍條會在懸停的文字上生長,文字會改變顏色。我有基本的元素,但由於某些原因,酒吧的表現非常糟糕,不會保持原樣。這似乎是浮動的結果,但我看不到如何讓寬度向左增長。
這裏是我的jQuery代碼
$(document).ready(function(e) {
$('.work_link').hover(
function() {
$('.work_link').stop(true,false).animate({color:'#ffffff'}, 500);
$('#splash_bar_mono').stop(true, false).animate({width:'350px'}, 500).css({'float':'right'});
//mouseover
},
function() {
$('.work_link').stop(true, false).animate({color:'#000'}, 500);
$('#splash_bar_mono').stop(true, false).animate({width:'10px'}, 500);//mouseout
});
$('.play_link').hover(
function() {
$('.play_link').stop(true, false).animate({color:'#ffffff'}, 500);
$('#splash_bar_mono').animate({width:'325px'}, 500).css({'float':'left'});//mouseover
},
function() {
$('.play_link').stop(true, false).animate({color:'#000'}, 500);//mouseout
$('#splash_bar_mono').stop(true, false).animate({width:'10px'}, 500);
});
});
下面是網站的HTML
<body id="splash">
<div id="splash_center">
<div style="z-index:200;" id="splash_work"><a style="z-index:200;" class="work_link" href="#">WORK</a></div>
<div style="z-index:200;"id="splash_play"><a style="z-index:200;" class="play_link" href="#">PLAY</a></div>
<div id="splash_bars">
<div style="z-index:-200;" id="splash_bar_mono"></div>
</div>
</div>
<div id="splash_graphic"></div>
</body>
</html>
哇,這是順暢了很多。我認爲這是一個更好,更簡單的解決方案。我不知道你可以如此動畫化背景位置。天才。 – ScottyC
這很好,但它在Firefox中被破壞了......我認爲它與firefox不支持background-position-x功能有關。有什麼想法嗎? – ScottyC