0

I am working on a script that scrolls table data in a continuous loop. The issue I have is, I keep getting the following error:

"too much recursion".

Does anyone know how I can use the script without this error happening?

$.fn.confScrollUp=function(){

var self=this,conf=self.children()
setInterval(function(){
    conf.slice(30).hide()
    conf.filter(':hidden').eq(0).slideDown()
    conf.eq(0).slideUp(4000, "linear",function(){
        $(this).appendTo(self)
        conf=self.children()
    })
},1)
return this;
}


$(function(){
    $('section').confScrollUp()
})

There is not user interaction, its just for displaying data.

8
  • 3
    Are you sure you want that setInterval firing once every millisecond? Commented Aug 12, 2017 at 17:21
  • @Andy Hi to be honest, no.I just need the scroll to work but I am not sure what to change. Commented Aug 12, 2017 at 17:26
  • Can you add it to a jsfiddle or something so we can see it not working? Commented Aug 12, 2017 at 17:28
  • @Andy Hi, jsfiddle.net/Blackbox/dsm3dg55/10 I have changed the code to scroll faster but its too fast. Commented Aug 12, 2017 at 17:35
  • 1
    @Andy Great, that works. Many thanks for your time. Make it an answer please. Commented Aug 12, 2017 at 17:45

1 Answer 1

1

This seems to work error-free if you increase the setInterval interval. Here I've chosen 100 to go along with the increase in the slider value to 4000.

$.fn.infiniteScrollUp=function(){
    var self=this,conf=self.children()
    setInterval(function(){
        conf.slice(10).hide();
      conf.filter(':hidden').eq(0).slideDown()
      conf.eq(0).slideUp(4000, "linear",function(){
        $(this).appendTo(self);
        conf=self.children();
      });
    },100)
    return this;
}
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.