1
我試圖讓div
向上移動,並在點擊特定鏈接時淡出。我已經完成了它,但它似乎有點突然。 IE:div
向上移動,但在div
完成淡出之前停止向上移動,無論fadeOut
方法的持續時間如何。我的目標是在它向上移動時淡出,這樣你就永遠不會看到它移動到頂端,所以它看起來正在被刷掉和消失。平滑移動和淡出
下面的代碼:
$(document).ready(function() {
$("#bannerText").fadeIn(2000);
$(".showSites").click(function() {
$('#bannerText').animate({
'marginTop': "-=750px"}).fadeOut(0);
});
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div id="bannerText">
<h1>Welcome</h1>
<div class="subText">
<span>There will be more here soon, I promise. For now, <a href="#" class="showSites">see what I've done so far.</a></span>
</div>
</div>
我可以發佈它生活會有所幫助,因爲DIV在屏幕的正中,所以片段並沒有做太多好。
如果有任何問題,我可以做些什麼來消除這種情況?
編輯:here it is live,以更好地瞭解它的外觀。
這是接近,但它仍然看起來像'.fadeOut()'沒有發生,直到'.animate()'在頂部結束。 :/ –
@JoshHollis是的我得到了..持有 –
@JoshHollis答案更新..檢查演示你需要使用'不透明' –