" ); $("#descripcionarticulo").append(htmldesc); } var len = $('script').filter(function () { return ($(this).attr('src') == 'https://cdn5.juguetilandia.com/js/magnific-popup.js'); }).length; //if there are no scripts that match, the load it if (len === 0) { var file = document.createElement("script"); file.setAttribute("type", "text/javascript"); file.setAttribute("src", "https://cdn5.juguetilandia.com/js/magnific-popup.js"); file.setAttribute("id", "MagnificPopup"); document.getElementsByTagName("head")[0].appendChild(file); setTimeout(function() { $('.image-popup-vertical-fit').magnificPopup({ type: 'image', closeOnContentClick: true, mainClass: 'mfp-img-mobile', image: { verticalFit: true } }); $('.image-popup-fit-width').magnificPopup({ type: 'image', closeOnContentClick: true, image: { verticalFit: false } }); $('.image-popup-no-margins').magnificPopup({ type: 'image', closeOnContentClick: true, closeBtnInside: false, mainClass: 'mfp-no-margins', // class to remove default margin from left and right side image: { verticalFit: true } }); /* $('.popup-gallery').magnificPopup({ delegate: 'a', type: 'image', tLoading: 'Loading image #%curr%...', mainClass: 'mfp-img-mobile', gallery: { enabled: true, navigateByImgClick: true, preload: [0,1] // Will preload 0 - before current, and 1 after the current image }, image: { tError: 'The image #%curr% could not be loaded.', titleSrc: function(item) { return item.el.attr('title'); } } }); */ $('.popup-with-zoom-anim').magnificPopup({ type: 'inline', fixedContentPos: false, fixedBgPos: true, overflowY: 'auto', closeBtnInside: true, preloader: false, midClick: true, removalDelay: 300, mainClass: 'my-mfp-zoom-in' }); $('.popup-with-move-anim').magnificPopup({ type: 'inline', fixedContentPos: false, fixedBgPos: true, overflowY: 'auto', closeBtnInside: true, preloader: false, midClick: true, removalDelay: 300, mainClass: 'my-mfp-slide-bottom' }); }, 100); } else{ $('.imagenPrincipal').css('left','0'); $('.imagenPrincipal').css('height','83%'); $('.imagenPrincipal').css('position','absolute'); $('.imagenPrincipal').css('width','100%'); } }); var cookiebot1 = "https://cdn.connectif.cloud/eu3/client-script/816303d1-5591-4d85-a06e-2e0a63477527"; var cookiebot2 = "__cn_client_script_816303d1-5591-4d85-a06e-2e0a63477527"; jQuery(document).on("mousemove.cookiebot_defer scroll.cookiebot_defer", function(e) { var len = $('script').filter(function () { return ($(this).attr('src') == cookiebot1); }).length; if (len === 0) { !function(e){ function t(){ if(!e.querySelector("#"+cookiebot2)){ var t=e.createElement("script");t.setAttribute("src",cookiebot1),e.body.appendChild(t) } }"complete"===e.readyState||"interactive"===e.readyState?t():e.addEventListener("DOMContentLoaded",t) }(document); } }); var tiempo = 11063000; var _second = 1000; var _minute = _second * 60; var _hour = _minute * 60; var entrega = function() { var hours = Math.floor(tiempo / _hour); var minutes = Math.floor((tiempo % _hour) / _minute); var seconds = Math.floor((tiempo % _minute) / _second); var strHours = hours; var strMinutes = ("0" + minutes).slice(-2); var strSeconds = ("0" + seconds).slice(-2); $("#entrega").text(strHours + "h " + strMinutes + "m " + strSeconds + "s"); tiempo = tiempo - 1000; if(tiempo < 0) tiempo = 0; }; entrega(); setInterval(entrega, 1000); $(".botonSubirArticulo").click(function(){ var $curr = $(this).prev(); var $max = $(this).val(); //alert("Valor Máximo "+$max+" Valor Actual "+$curr.val()); if(parseInt($curr.val()) < parseInt($max)) $curr.val(parseInt($curr.val()) + 1); }); $(".botonBajarArticulo").click(function(){ var $curr = $(this).next(); if(parseInt($curr.val()) > 1) $curr.val(parseInt($curr.val()) - 1); }); $(document).ready(function() { //responsive menu toggle $("#menutoggle").click(function() { $('.xs-menu').toggleClass('displaynone'); }); //add active class on menu $('ul li').click(function(e) { /* e.preventDefault(); */ $('li').removeClass('active'); $(this).addClass('active'); }); //drop down menu $(".drop-down").hover(function() { $('.mega-menu').addClass('display-on'); }); $(".drop-down").mouseleave(function() { $('.mega-menu').removeClass('display-on'); }); $(".drop-down2").hover(function() { $('.mega-menu2').addClass('display-on'); }); $(".drop-down2").mouseleave(function() { $('.mega-menu2').removeClass('display-on'); }); $(".drop-down3").hover(function() { $('.mega-menu3').addClass('display-on'); }); $(".drop-down3").mouseleave(function() { $('.mega-menu3').removeClass('display-on'); }); $(".drop-down4").hover(function() { $('.mega-menu4').addClass('display-on'); }); $(".drop-down4").mouseleave(function() { $('.mega-menu4').removeClass('display-on'); }); }); $("#jinfo").hover(function () { $('body').animate({ 'background-color': '#ff3c3c' }); }, function () { $('body').animate({ 'background-color': '#d4e88f' }); }); jQuery(document).on("mousemove.doofinder_defer scroll.doofinder_defer", function(e) { var len = $('script').filter(function () { return ($(this).attr('src') == 'https://cdn.doofinder.com/media/js/doofinder-classic.7.latest.min.js'); }).length; if (len === 0) { var doofinder_script ='https://cdn.doofinder.com/media/js/doofinder-classic.7.latest.min.js'; (function(d,t){var f=d.createElement(t),s=d.getElementsByTagName(t)[0];f.async=1; f.src=doofinder_script; f.setAttribute('charset','utf-8'); s.parentNode.insertBefore(f,s)}(document,'script')); } }); }); }); }); /* }); */ }); }); }); }); }); }); }); })(); document.zoomParams = { magnify:1.5 , on: "click" , onZoomIn: function() { $(".zoomImg").css("cursor", "crosshair"); } , onZoomOut: function() { $(".zoomImg").css("cursor", "cell"); } , oneTouch: false , touch: false }; const intercept = (urlmatch, callback) => { let send = XMLHttpRequest.prototype.send; XMLHttpRequest.prototype.send = function() { this.addEventListener('readystatechange', function() { if (this.responseURL.includes(urlmatch) && this.readyState === 4) { callback(this); } }, false); send.apply(this, arguments); }; }; intercept("instalment-plan-simulator", function(xhr) { $(".financiacion").html("Desde " + JSON.parse(xhr.responseText).choices[0].instalments[5].amount / 100 + " € / mes "); }); function cargarImagen(num) { $(".carouselPrincipal").carousel(num); } function cargarZoom() { if( !/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) { $('.zoom').zoom(document.zoomParams); zoomCambiarFotos(); } } function zoomCambiarFotos() { if($(".zoomImg").length > 0 && $(".zoom").length == $(".zoomImg").length) { $(".zoomImg").each(function(index, elem) { cambiarNombreFoto(elem); }); } else { setTimeout(zoomCambiarFotos, 100); } } function cambiarNombreFoto(elem) { var file = elem.src.substring(0, elem.src.lastIndexOf(".") - 3); var numero = elem.src.substring(elem.src.lastIndexOf(".") - 2, elem.src.lastIndexOf(".")); elem.onerror = function() { elem.onerror = null; elem.src = file + "g" + numero + ".jpg"; console.log("cambia y a g"); if( ! /Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent) ) { var magnifyOld = document.zoomParams.magnify; var zoom = $(elem).parent(".zoom"); zoom.trigger('zoom.destroy'); setTimeout(function() { document.zoomParams.magnify = 2; zoom.zoom(document.zoomParams); setTimeout(function() { document.zoomParams.magnify = magnifyOld; }, 100); }, 100); } }; elem.src = file + "y" + numero + ".webp"; } function zoomPopup(disable) { if($("body").hasClass("zoomPopup")) { if(disable) { $("body").removeClass("zoomPopup"); $(".zoomPopup-cloned").remove(); $(".botonComprarFichaProducto-cloned").remove(); $(".zoomPopup-container #carouselPrincipal2").prop("id", "carouselPrincipal"); $(".zoomPopup-container #carousel2").prop("id", "carousel"); } } else { $("body").addClass("zoomPopup"); var cloned = $(".zoomPopup-container").clone(); cloned.addClass("zoomPopup-cloned").removeClass("zoomPopup-container"); $("body").append(cloned); var comprarCloned = $(".botonComprarFichaProducto").clone(); comprarCloned.addClass("botonComprarFichaProducto-cloned"); $("body").append(comprarCloned); $(".zoomPopup-cloned .zoom img").each(function(index, elem) { cambiarNombreFoto(elem); }); $(".zoomPopup-container #carouselPrincipal").prop("id", "carouselPrincipal2"); $(".zoomPopup-container #carousel").prop("id", "carousel2"); enableCarouselPrincipal(".carouselPrincipal"); enableCarousel(".zoomPopup-cloned #carousel"); $("#carouselPrincipal").carousel({interval:0}); $("#carousel").carousel({interval:4000}); var boton = $(""); $(".zoomPopup-cloned").append(boton); boton.on("click", function() { zoomPopup(true); }); comprarCloned.on("click", function() { zoomPopup(true); }); } }