我想讓一些文字從下往上淡入滾動。 現在,我有這樣的代碼:如何從下往上淡入
$(document).ready(function() {
/* Every time the window is scrolled ... */
$(window).scroll(function(){
/* Check the location of each desired element */
$('.hideme').each(function(i){
var bottom_of_object = $(this).offset().top + $(this).outerHeight();
var bottom_of_window = $(window).scrollTop() + $(window).height();
/* If the object is completely visible in the window, fade it it */
if(bottom_of_window > bottom_of_object){
$(this).animate({'opacity':'1'},1000);
}
});
});
});
現在它只是在消失,但我希望它在從底部到頂部褪色。 任何想法的?
你能否發佈一個plunker來更詳細地理解你正試圖解決的問題? –
現在,我得到了這個:https://jsfiddle.net/tcloninger/e5qaD/,但它只是在它atm的地方消失。我想讓它淡入一種動畫,所以它從屏幕底部飛到它所屬的地方。 –
我簡單地想出了這個:https://jsfiddle.net/8rkf4njp/它符合你的描述,但是你**在評論中增加了**更多信息來澄清要求,所以它不是你想要的,但是根據問題「從下到上淡入」(小提琴有很長的時間來顯示它在做什麼)。 –