I have been working on two column website, whereby when you scroll: column A goes up and column B goes down. I implemented an infinite scroll but what I am wondering is: is it possible to clone/append one column onto the other e.g. at a certain length of scrolling:
Once scrolled out of view:
- Column A boxes will move onto the end of column B
- Column B boxes will move onto the end of column A
Technically still infinite but looping the boxes from column to column - spilling one into the other and back again.
Is this approach bad, or, is it better to just use endless scroll on each column? What is tripping me up, as I am new to JS and jQuery, is the logic, and what is the best approach to achieve this.
*Image just for example, the amount of boxes could be a lot higher e.g. 10 in each column.
My code so far: http://jsfiddle.net/djsbaker/vqUq7/1/
My current attempt at clone/append:
var ele = document.getElementById("box");
var arr = jQuery.makeArray(ele);
var data = (ele)[0];
$(window).scroll(function() {
if ( $(window).scrollTop() >= 1000) {
$(data).clone().appendTo('body');
} else {
..
}
});