reuso de infinite scroll

This commit is contained in:
humano 2017-11-06 18:11:35 -05:00
parent 919fd5e05a
commit e7768cf146
2 changed files with 35 additions and 33 deletions

View File

@ -405,6 +405,9 @@ if ($variable !=''){
<link rel='stylesheet' type='text/css' href='librerias/slick/style.css'> <link rel='stylesheet' type='text/css' href='librerias/slick/style.css'>
<script src='manup.js'></script> <script src='manup.js'></script>
"; ";
$registros=1;
$plantilla="landingpage";
$librerias_cabeza ="$presentacion_cabeza $librerias_galeria $librerias_cabeza ="$presentacion_cabeza $librerias_galeria
@ -422,13 +425,14 @@ if('serviceWorker' in navigator) {
<script type = 'text/javascript' > <script type = 'text/javascript' >
$(document).ready(function() { $(document).ready(function() {
loadArticle(1); loadArticle(1,$form,'$plantilla',$registros,'scroll-content');
loadArticle(2); loadArticle(2,$form,'$plantilla',$registros,'scroll-content');
loadArticle(3); loadArticle(3,$form,'$plantilla',$registros,'scroll-content');
loadArticle(4); loadArticle(4,$form,'$plantilla',$registros,'scroll-content');
loadArticle(5); loadArticle(5,$form,'$plantilla',$registros,'scroll-content');
loadArticle(6); loadArticle(6,$form,'$plantilla',$registros,'scroll-content');
loadArticle(7); loadArticle(7,$form,'$plantilla',$registros,'scroll-content');
var count = 8; var count = 8;
$('div').scroll(function() { $('div').scroll(function() {
var offset = $('#scroll-content div').length; var offset = $('#scroll-content div').length;
@ -438,42 +442,20 @@ if('serviceWorker' in navigator) {
var isScrolledToEnd = (scroll >= height); var isScrolledToEnd = (scroll >= height);
$('.scroll-pos').text(scroll);
$('.scroll-height').text(height);
if (isScrolledToEnd) { if (isScrolledToEnd) {
loadArticle(count); loadArticle(count,$form,'$plantilla',$registros,'scroll-content');
count++; 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&registros=1&pagina=' + pageNumber,
type: 'POST',
dataType: 'html',
success: function(html) {
// $('#scroll-contentx').append(html);
var contenido = html;
newDiv.innerHTML = contenido;
}
});
}
</script> </script>

View File

@ -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+'&registros='+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) { function leer_exif(campo,campo_mapa) {
// alert(campo) // alert(campo)
// var file = e.target.files[0] // var file = e.target.files[0]