javascript - Loading results onscroll down of a div -


I have to apply face-like disparities such as loading a lot of page load. Style for outer div and inner devi

 . Upper (height: 1430px; margin-top: -12 pixels; hidden plume; width: 99%;} player {height: 1435 px; overflow-y: scroll; position: relative; width: 103%;}  

So for this there are two div's inner and external and attached inline oncroll functions for my internal divas. I am able to scroll the record inside the inner divis without the scroll bar, whose This is loading 10 times for the first time. When I scroll up to the 7th record, I need to make a server call, add more than 10 results to the 10 inner division.

To find the scroll position on the 7th record and trigger the operation of the server What is the best way?

Since the website has a responsibility, does the oncollic work well on all devices? Or any other better way to require it.

I had a similar problem.

I use the following for now (but I only support Chrome):

  var handleScroll = function (event ) {Var container = event.target; If ((container. ScrollTop + container.offsetHeight) + 1> = container.scrollHeight) {...}}  

You basically do not care about the 7th record , Just your user is scrolling down.

Some extra things you can do:

  • Add a little animated IMG (like a rotating circle) while dragging from the server. Do this by adding an additional device up or down. To remove it when the server is called / error occurs.
  • There are so many onslocked calls, if this happens you can get lots of server calls You can mess / de-bounce using the timer:

      document.getElementById ('myid'). Onscroll = function (oEvent) {if (this.timer) {clearTimeout (this.timer); } This.timer = setTimeout (function () {this.handleScroll (oEvent);} .bind (this), 250); } .bind (this);  

Comments