2016-11-13 54 views

回答

0

使用一個事件偵聽器:

window.addEventListener("scroll",()=>{ 
    if(((window.pageYOffset || doc.scrollTop) - (doc.clientTop || 0))>300){ 
     //replace image if scrolled more than 300 
    }else{ 
    //replace with other image 
}},false); 
相關問題