I made a JSON calling a database information, however I went to use a plugin from slide and it does not work. But it seems q is not only it, with other types of function too, it seems that it does not recognize the id or class. But if I do in HTML normal, it works.
<div class="swiper-container" id="leitor">
<div id="leitor2"></div>
<!-- Add Pagination -->
<div class="swiper-pagination swiper-pagination-white"></div>
<!-- Add Navigation -->
<div class="swiper-button-prev"></div>
<div class="swiper-button-next"></div>
</div>
<!-- Swiper JS -->
<script src="js/jquery.min.js"></script>
<script src="js/app.js"></script>
<script src="js/materialize.min.js"></script>
<script src="js/swiper.js"></script>
<script src="js/swiper.min.js"></script>
<script src="js/swiper.esm.js"></script>
<script src="js/swiper.esm.bundle.js"></script>
<!-- Initialize Swiper -->
<script type="text/javascript">
$(document).ready(function () {
var swiper = new Swiper('.swiper-container', {
zoom: true,
lazy: true,
pagination: {
el: '.swiper-pagination',
},
navigation: {
nextEl: '.swiper-button-next',
prevEl: '.swiper-button-prev',
},
});
});
</script>
$(document).ready(function(){
var container = $("#leitor");
var lista = container.find("#leitor2");
var html = '';
var query = location.search.slice(1);
var partesDaQuery = query.split("&");
var json = {};
partesDaQuery.forEach(function(partes){
var chaveValor = partes.split('=');
var paramsKey = chaveValor[0];
var paramsValue = chaveValor[1];
json[paramsKey] = paramsValue;
$.getJSON('http://teste.com/app2.php?id='+json[paramsKey],
function(data){
$.each(data, function(k, v){
html += '<div class="swiper-slide">';
html += '<div class="swiper-zoom-container">';
//Essa parte da imagem ainda não acabei.
html +=
'<img src="http://teste.com/leitor/capa/'+v.titulo+'/170/01.jpg"class="swiper-lazy">';
html +=
'<div class="swiper-lazy-preloader swiper-lazy-preloader-white"></div>';
html += '</div>';
});
lista.html(html);
});
});
});