mejoras en la api

This commit is contained in:
humano 2017-11-06 16:29:33 -05:00
parent 9b9d3ed8d2
commit 919fd5e05a
3 changed files with 77 additions and 69 deletions

View File

@ -405,7 +405,10 @@ if ($variable !=''){
<link rel='stylesheet' type='text/css' href='librerias/slick/style.css'>
<script src='manup.js'></script>
";
$librerias_cabeza ="$presentacion_cabeza $librerias_galeria";
$librerias_cabeza ="$presentacion_cabeza $librerias_galeria
";
$librerias_pie ="$aplicacion_pie
<!-- <script>
if('serviceWorker' in navigator) {
@ -414,30 +417,67 @@ if('serviceWorker' in navigator) {
.then(function() { console.log('Service Worker Registered'); });
}
</script> -->
<script>
document.getElementById('scroll-content').addEventListener('scroll', function (event) {
var newDiv = document.createElement('div');
newDiv.innerHTML = 'my awesome new div';
document.getElementById('scroll-content').appendChild(newDiv);
});
var checkForNewDiv = function () {
var lastDiv = document.querySelector('#scroll-content > div:last-child');
var maindiv = document.querySelector('#scroll-content');
var lastDivOffset = lastDiv.offsetTop + lastDiv.clientHeight;
var pageOffset = maindiv.offsetTop + maindiv.clientHeight;
if (pageOffset > lastDivOffset - 10) {
var newDiv = document.createElement('div');
newDiv.innerHTML = 'my awesome new div';
document.getElementById('scroll-content').appendChild(newDiv);
checkForNewDiv();
}
};
<script type = 'text/javascript' >
$(document).ready(function() {
loadArticle(1);
loadArticle(2);
loadArticle(3);
loadArticle(4);
loadArticle(5);
loadArticle(6);
loadArticle(7);
var count = 8;
$('div').scroll(function() {
var offset = $('#scroll-content div').length;
var \$this = $(this);
var height = this.scrollHeight - \$this.height(); // Get the height of the div
var scroll = \$this.scrollTop(); // Get the vertical scroll position
var isScrolledToEnd = (scroll >= height);
$('.scroll-pos').text(scroll);
$('.scroll-height').text(height);
if (isScrolledToEnd) {
loadArticle(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;
}
});
}
checkForNewDiv();
</script>
";
$registros = aplicacion_carrusel("$form",'10','','embebido','',"carousel");
@ -517,9 +557,15 @@ checkForNewDiv();
<section id='mapa'>
$mapa
</section>
<section id='listado' class='scrollable'>
<section id='listado' class='' >
<div class='container-fluid'>
<div id='scroll-content' style='overflow-y: scroll; overflow-x: hidden; max-height: calc(100vh - 50px);
min-height: calc(100vh - 50px); '>
</div>
</div>
</section>
</div>
</div>$footer";
@ -1352,15 +1398,10 @@ $(document).ready(function() {
<style>
#scroll-content > div {
background: #c0c0c0;
height: 40px;
margin-bottom: 5px;
}
#scroll-content
{
height:300px;
overflow:auto;
}
</style>

View File

@ -16,7 +16,7 @@
background-position: 50% 50%;
}
</style>
<script type="text/javascript">
<script type="text/javascript">
$(document).ready(function () {
loadArticle(1);
@ -36,49 +36,16 @@
if (isScrolledToEnd) {
loadArticle(count);
// var additionalContent = GetMoreContent(); // Get the additional content
//alert("hola");
count++;
document.getElementById("paginas").innerHTML=count;
/*
var newDiv = document.createElement("div");
newDiv.setAttribute("class", "container");
$.ajax({
//url: 'get-post.php?variable='+(offset),
url: '../milfs/api.php?id=74&tipo=simple&formato=li&registros=1&pagina='+offset,
dataType: 'html',
success: function(html) {
// $('#scroll-contentx').append(html);
var contenido = html;
// $('#loading').hide();
newDiv.innerHTML = contenido;
//newDiv.innerHTML.append(html);
}
});
document.getElementById("scroll-content").appendChild(newDiv);
document.getElementById("paginas").innerHTML=offset;
// checkForNewDiv();
*/
// $this.append(additionalContent); // Append the additional content
}
});
});
function loadArticle(pageNumber){
var newDiv = document.createElement("div");
newDiv.setAttribute("class", "container");
// newDiv.setAttribute("class", "container");
// var contenido ="Hola mundo "+ pageNumber;
// newDiv.innerHTML = contenido;
@ -112,11 +79,11 @@ appendScroll: $('#scroll-content')
<body>
<div class='container' style="overflow-y: scroll; overflow-x: hidden; height: 400px; border: 1px solid red;">
<div id="wrapper">
<div id="scroll-content">
<div id='posts'></div>
</div>
</div>
</div>
<div id='paginas'>las paginas</div>
Scroll Height: <span class="scroll-height"></span> <br/>

View File

@ -32,7 +32,7 @@ if(!isset($_REQUEST['formato'])) {
header('Content-Type: application/json');
echo json($datos);
}else{
echo "$datos[pagina] ".consultar_contenido_formulario("$datos[id]","$datos[registros]","$datos[pagina]","$datos[formato]",'',"$datos[plantilla]");
echo "<br><br><div class='container-fluid '>".consultar_contenido_formulario("$datos[id]","$datos[registros]","$datos[pagina]","$datos[formato]",'',"$datos[plantilla]")."</div>";
}
//echo "hola /// $_REQUEST[id] // " ;