This was a bit of a challenge but I figured it out!
So how do you get Views to Scroll?
You do a little research, dip and dive, then make some jQuery Code to make it happen =). The situation that I had to solve didn’t really require a scroll and load. The client wanted to have a button, that, when clicked, would load more results IN ADDITION to what was there. Hence, infinite scroll qualities.
I haven’t tested a scrolling version yet because I didn’t need to but I’m sure replacing the
click() function with
scroll() would get you more towards the scrolling and load action.
In any case, here’s the snippet:
I was going to add the HTML but it’s just a table with a class
.main_table and a button with class
.load_more. Easy enough, right?
Break it down!
This little gem
.main_table tr:gt(9) means greater than 9. Remember code starts at 0, so gt(9) shows 10 results, everything else will be hidden. You can change that to anything you want.
The rest of the code is pretty much all commented to let you know what it does.
You would generally use this if you’re listing information in a table format. It can be for a directory, a list of posts, anything! And it works awesomely!
In fact, you can try the demo here:
Try The Demo!
(styles not included)
Let me know if you have any questions!