React öğrenmekteyim. Java ile backend bir servis yazdım. Bu servis Oracle DB'den verileri alıyor. Ben sadece 10 tanesini listeliyorum ilk anda. Scroll sona geldiğinde tekrar istek atmasını istiyorum. Kaldığı yerden atması için gerekli düzenlemeleri yaptım sorguda fakat scroll bittiğinde benim bu requesti tetiklemem lazım. Nasıl yapabilirim? Araştırdım, bir kütüphane yazmışlar fakat çalışmadı maalesef. Direkt olarak React'ta yok mu böyle bir Event?
Çözümü buldum. İnternet üzerinde zaten aşağıdaki kod bulunuyordu. Onun da çalışmama nedenini buldum. Konumu aşağıya yuvarlayınca istediğim olay çalıştı. Arayanlar için belki faydalı olur. onScroll eventine aşağıdaki methodu verdiğinizde istediğimiz şey olmuş oluyor.
JavaScript:
handleScroll(event) {
var target = event.target;
var placeValue = Math.floor(target.scrollHeight - target.scrollTop);
if(placeValue === target.clientHeight){
console.log("Scroll en aşağıda");
}
}
I have a website with different sections. I am using segment.io to track different actions on the page. How can I detect if a user has scrolled to the bottom of a div? I have tried the following bu...
I have a website with different sections. I am using segment.io to track different actions on the page. How can I detect if a user has scrolled to the bottom of a div? I have tried the following bu...
Linkte verdiğiniz kod bende çalışmamıştı, ek olarak Math.floor() eklediğim zaman çalışmayı başardı. React içerisinde böyle hazır bir event olup olmadığını merak etmiştim. Teşekkürler.