forked from qwerty/tupali
reuso de infinite scroll
This commit is contained in:
parent
919fd5e05a
commit
e7768cf146
48
index.php
48
index.php
@ -405,6 +405,9 @@ if ($variable !=''){
|
||||
<link rel='stylesheet' type='text/css' href='librerias/slick/style.css'>
|
||||
<script src='manup.js'></script>
|
||||
";
|
||||
|
||||
$registros=1;
|
||||
$plantilla="landingpage";
|
||||
$librerias_cabeza ="$presentacion_cabeza $librerias_galeria
|
||||
|
||||
|
||||
@ -422,13 +425,14 @@ if('serviceWorker' in navigator) {
|
||||
<script type = 'text/javascript' >
|
||||
$(document).ready(function() {
|
||||
|
||||
loadArticle(1);
|
||||
loadArticle(2);
|
||||
loadArticle(3);
|
||||
loadArticle(4);
|
||||
loadArticle(5);
|
||||
loadArticle(6);
|
||||
loadArticle(7);
|
||||
loadArticle(1,$form,'$plantilla',$registros,'scroll-content');
|
||||
loadArticle(2,$form,'$plantilla',$registros,'scroll-content');
|
||||
loadArticle(3,$form,'$plantilla',$registros,'scroll-content');
|
||||
loadArticle(4,$form,'$plantilla',$registros,'scroll-content');
|
||||
loadArticle(5,$form,'$plantilla',$registros,'scroll-content');
|
||||
loadArticle(6,$form,'$plantilla',$registros,'scroll-content');
|
||||
loadArticle(7,$form,'$plantilla',$registros,'scroll-content');
|
||||
|
||||
var count = 8;
|
||||
$('div').scroll(function() {
|
||||
var offset = $('#scroll-content div').length;
|
||||
@ -438,42 +442,20 @@ if('serviceWorker' in navigator) {
|
||||
|
||||
var isScrolledToEnd = (scroll >= height);
|
||||
|
||||
$('.scroll-pos').text(scroll);
|
||||
$('.scroll-height').text(height);
|
||||
|
||||
if (isScrolledToEnd) {
|
||||
loadArticle(count);
|
||||
loadArticle(count,$form,'$plantilla',$registros,'scroll-content');
|
||||
count++;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
function loadArticle(pageNumber) {
|
||||
|
||||
var newDiv = document.createElement('div');
|
||||
//newDiv.setAttribute('class', 'container');
|
||||
// var contenido ='Hola mundo '+ pageNumber;
|
||||
// newDiv.innerHTML = contenido;
|
||||
|
||||
//newDiv.innerHTML.append(html);
|
||||
document.getElementById('scroll-content').appendChild(newDiv);
|
||||
|
||||
$.ajax({
|
||||
//url: 'get-post.php?variable='+(offset),
|
||||
url: 'milfs/api.php?id=$form&tipo=simple&formato=li&plantilla=landingpage®istros=1&pagina=' + pageNumber,
|
||||
type: 'POST',
|
||||
dataType: 'html',
|
||||
success: function(html) {
|
||||
// $('#scroll-contentx').append(html);
|
||||
var contenido = html;
|
||||
newDiv.innerHTML = contenido;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
</script>
|
||||
|
||||
|
@ -1,4 +1,24 @@
|
||||
function loadArticle(pageNumber,id,plantilla,registros,scroll) {
|
||||
|
||||
var newDiv = document.createElement('div');
|
||||
document.getElementById(scroll).appendChild(newDiv);
|
||||
|
||||
$.ajax({
|
||||
|
||||
url: 'milfs/api.php?id='+id+'&tipo=simple&formato=li&plantilla='+plantilla+'®istros='+registros+'&pagina=' + pageNumber,
|
||||
type: 'POST',
|
||||
dataType: 'html',
|
||||
success: function(html) {
|
||||
// $('#scroll-contentx').append(html);
|
||||
var contenido = html;
|
||||
newDiv.innerHTML = contenido;
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
}
|
||||
|
||||
|
||||
function leer_exif(campo,campo_mapa) {
|
||||
// alert(campo)
|
||||
// var file = e.target.files[0]
|
||||
|
Loading…
Reference in New Issue
Block a user