![](/img/trans.png)
[英]Change (fade in/out) fixed background image when scrolling div into view
[英]fade in a div-bar as background for my header when scrolling
嘗試這個。
/* Every time the window is scrolled ... */
jQuery(window).scroll( function(){
/* Check the location of element */
jQuery('.hideme').each( function(i){
var logo = jQuery(this).outerHeight();
var position = jQuery(window).scrollTop();
/* fade out */
if( position > logo ){
jQuery(this).animate({'opacity':'0'},500);
}else{ jQuery(this).animate({'opacity':'1'},500);}
});
});
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.