Answer the question
In order to leave comments, you need to log in
How to dynamically load content vertically?
Good afternoon, the task is to implement horizontal scrolling (I know it’s not a very good idea, it will interfere with the user in terms of usability)
But the client wants that’s all
Here is an example:
www.archi-graphi.fr
The problem is what needs to be done dynamically and not statically ( that is, the content should be loaded news (categories) but gradually so as not to load the site.I
really hope for your help, since I have a dead end in implementation.
Answer the question
In order to leave comments, you need to log in
The algorithm is no different from loading vertically.
For example:
var curPage = 1, online;
document.onscroll = function(){
if(window.pageXOffset > this.body.offsetWidth - 2 * window.innerWidth){
if(online){
return;
}else{
online = curPage++, true;
}
//Подгружаем новый контент страницы под номером curPage
//Не забываем по окончанию запроса приравнять online к false
//Если в ответе пусто, т.е, статьи кончились - убираем обработчик scroll
}
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question