(function($){ $.fn.UItoTop = function(options) { var defaults = { text: 'To Top', min: 200, inDelay:600, outDelay:400, containerID: 'toTop', containerHoverID: 'toTopHover', scrollSpeed: 1200, easingType: 'linear' }, settings = $.extend(defaults, options), containerIDhash = '#' + settings.containerID, containerHoverIDHash = '#'+settings.containerHoverID; $('body').append(''+settings.text+''); $(containerIDhash).hide().on('click.UItoTop',function(){ $('html, body').animate({scrollTop:0}, settings.scrollSpeed, settings.easingType); $('#'+settings.containerHoverID, this).stop().animate({'opacity': 0 }, settings.inDelay, settings.easingType); return false; }) .prepend('') .hover(function() { $(containerHoverIDHash, this).stop().animate({ 'opacity': 1 }, 600, 'linear'); }, function() { $(containerHoverIDHash, this).stop().animate({ 'opacity': 0 }, 700, 'linear'); }); $(window).scroll(function() { var sd = $(window).scrollTop(); if(typeof document.body.style.maxHeight === "undefined") { $(containerIDhash).css({ 'position': 'absolute', 'top': sd + $(window).height() - 50 }); } if ( sd > settings.min ) $(containerIDhash).fadeIn(settings.inDelay); else $(containerIDhash).fadeOut(settings.Outdelay); }); }; })(jQuery); function colocar_subir_inicio() { var scrollTop = $(window).scrollTop(); if (scrollTop <= 300) { $(".buttonUp").addClass('top'); } else { $(".buttonUp").removeClass('top'); } } var scrollTimeout; $(window).scroll(function () { if (scrollTimeout) { clearTimeout(scrollTimeout); } setTimeout(colocar_subir_inicio, 500); }); $(window).ready(function(){ //prueba span hover const target = document.querySelector(".lineaInferiorHoverMenu"); const links = document.querySelectorAll(".linkDesplegable"); const contenido = document.querySelector(".contenido"); const colors = ["#02679f"]; for (let i = 0; i < links.length; i++) { links[i].addEventListener("mouseenter", mouseenterFunc); } contenido.addEventListener("mouseenter", onFocusFunc); window.addEventListener("resize", resizeFunc); function onFocusFunc(){ for (let i = 0; i < links.length; i++) { links[i].style.opacity = "1"; } target.style.display = "none"; } function mouseenterFunc() { target.style.display = "inline"; if (!this.parentNode.classList.contains("active")) { for (let i = 0; i < links.length; i++) { if (links[i].parentNode.classList.contains("active")) { links[i].parentNode.classList.remove("active"); } links[i].style.opacity = "0.25"; } this.parentNode.classList.add("active"); this.style.opacity = "1"; var width; if(this.parentNode.getElementsByTagName('ul').length == 0){ width = this.getBoundingClientRect().width; }else{ width = this.parentNode.getElementsByTagName('ul')[0].getBoundingClientRect().width; } const height = this.getBoundingClientRect().height; const left = this.getBoundingClientRect().left + window.pageXOffset; const top = this.getBoundingClientRect().top + window.pageYOffset; const color = colors[Math.floor(Math.random() * colors.length)]; target.style.width = width+'px'; target.style.height = height+'px'; target.style.left = left+'px'; target.style.top = top+'px'; target.style.borderColor = color; target.style.transform = "none"; } } function resizeFunc() { const active = document.querySelector(".menuNav .megamenu li.active"); if (active) { const left = active.getBoundingClientRect().left + window.pageXOffset; const top = active.getBoundingClientRect().top + window.pageYOffset; target.style.left = left+'px'; target.style.top = top+'px'; } } var rv = -1; // Return value assumes failure if (navigator.appName == 'Microsoft Internet Explorer') { var ua = navigator.userAgent; var re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); if (re.exec(ua) != null) rv = parseFloat( RegExp.$1 ); } if (typeof mgnl != 'undefined' && mgnl!=null && mgnl.PageEditor!=null){ mgnl.PageEditor.onReady( function() { var localeSelector = $("select.mgnlEditorLocaleSelector"); if(localeSelector!=null){ $(localeSelector).find("option").each(function( index ) { var optValue = $(this).text(); if(optValue!=null && optValue!='' && optValue.toLowerCase().indexOf("va") >= 0){ optValue = optValue.replace("Va", "Valencià"); $(this).text(optValue); } }); } }); } // Renderizado videos if($(".object_elem")){ if(navigator.userAgent.indexOf("MSIE") != -1){ $('.object_elem.ie11-browser').remove(); }else{ $('.object_elem.ie-old').remove(); } $(".object_elem").each(function( index ) { if($(this).parents('.contenido_left.home').length<=0){ var parent = $(this).parent().get(0); $(this).height($(parent).height()*0.7); $(this).width($(parent).width()*0.7); } }); } // Activamos estilos con javascript activado. $('body').addClass('jsactivo'); // Control de elemento acordeón. if ($('ul.acordeon')) { acordeon.inicializar(); } //inicializar acordeon if($(".accordion").length>0) $(".accordion").accordion({ collapsible: true, active: false, autoHeight: false, heightStyle: "content" }); //end inicializacion acordeon //init Carousel if($('.md-carousel').length>0){ if (!Function.prototype.bind) { Function.prototype.bind = function(oThis) { if (typeof this !== 'function') { // closest thing possible to the ECMAScript 5 // internal IsCallable function throw new TypeError('Function.prototype.bind - what is trying to be bound is not callable'); } var aArgs = Array.prototype.slice.call(arguments, 1), fToBind = this, fNOP = function() {}, fBound = function() { return fToBind.apply(this instanceof fNOP && oThis ? this : oThis, aArgs.concat(Array.prototype.slice.call(arguments))); }; fNOP.prototype = this.prototype; fBound.prototype = new fNOP(); return fBound; }; } $('.md-carousel').slick({ infinite: false, adaptiveHeight: true, autoplay: true, arrows: false, pauseOnHover : false, dots: true, slidesToShow: 1, slidesToScroll: 1, autoplaySpeed: 6000, accesibility: true, responsive: [ { breakpoint: 1024, settings: { } }, { breakpoint: 768, settings: { arrows: true, dots: false } } ] }); } //fin init carousel /* init del calendario */ initCalendar(); /* Menu horizontal home */ /* $(".megamenu").accessibleMegaMenu({*/ $(".fun-menuNav").accessibleMegaMenu({ /* prefix for generated unique id attributes, which are required to indicate aria-owns, aria-controls and aria-labelledby */ uuidPrefix: "accessible-megamenu", /* css class used to define the megamenu styling */ menuClass: "nav-menu", /* css class for a top-level navigation item in the megamenu */ topNavItemClass: "nav-item", /* css class for a megamenu panel */ panelClass: "sub-nav", /* css class for a group of items within a megamenu panel */ panelGroupClass: "sub-nav-group", /* css class for the hover state */ hoverClass: "hover", /* css class for the focus state */ focusClass: "focus", /* css class for the open state */ openClass: "open" }); $(window).resize(function(){ if(window.innerWidth<"768"){ // igualar altura en carrusel del figure con respecto al contenedor var slideIMG = $(".carousel-cont_img").height(); var slideContent = $(".carousel-link").height(); if (slideIMG>slideContent){ $(".slick-track").css("height", slideIMG); } else { $(".slick-track").css("height", slideContent); } // fin igualar altura en carrusel del figure con respecto al contenedor $(".mod_navcontent_aside .fc-acordeon").accordion({ collapsible: true, active: false, autoHeight: false, navigation: true, heightStyle: "content", clearStyle: true }); for(var i=0;i<$(".mdc-item-content").length;i++){ $($(".mdc-item-content")[i]).appendTo($(".cont-info")[i]); } $(".mdc-item-content").css("visibility","inherit"); } else { $(".slick-track").css("height", "auto"); } if (window.innerWidth <= "1024" && window.innerWidth >= "768") { $(".md-carousel-content").css("padding-right","17.5px"); $(".md-carousel-content").css("padding-left","17.5px"); } if (window.innerWidth > "1024") { $(".md-carousel-content").css("padding-right","15px"); $(".md-carousel-content").css("padding-left","15px"); } if(window.innerWidth>"768"){ if($(".mod_navcontent_aside .fc-acordeon").hasClass("ui-accordion")){ $(".mod_navcontent_aside .fc-acordeon").accordion("destroy"); } for(var i=0;i<$(".mdc-item-content").length;i++){ $($(".mdc-image")[i]).appendTo($(".cont-info")[i]); } } }); $(window).load(function () { if(window.innerWidth<"768"){ // igualar altura en carrusel del figure con respecto al contenedor var slideContent = $(".md-carousel-content").height(); // Get the current slide $(".slick-track").css("height", slideContent); // fin igualar altura en carrusel del figure con respecto al contenedor // fin igualar altura en carrusel del figure con respecto al contenedor $(".mod_navcontent_aside .fc-acordeon").accordion({ collapsible: true, active: false, autoHeight: false, navigation: true, heightStyle: "content", clearStyle: true }); for(var i=0;i<$(".mdc-item-content").length;i++){ $($(".mdc-item-content")[i]).appendTo($(".cont-info")[i]); } $(".mdc-item-content").css("visibility","inherit"); } if (window.innerWidth <= "1024" && window.innerWidth >= "768") { $(".md-carousel-content").css("padding-right","17.5px"); $(".md-carousel-content").css("padding-left","17.5px"); } if (window.innerWidth > "1024") { $(".md-carousel-content").css("padding-right","15px"); $(".md-carousel-content").css("padding-left","15px"); } }); $(".slick-prev,.slick-next").click(function() { var currentSlide = $('.md-carousel').slick('slickCurrentSlide'); $(".md-carousel-content").each(function(idx, el) { var altSlideContent = $(".carousel-link")[idx].offsetHeight; if (currentSlide === idx) { $(".slick-track").css("height", altSlideContent); } }); }); }); function colocar_subir_inicio() { var scrollTop = $(document).scrollTop(); if (scrollTop <= 300) { $(".buttonUp").addClass('top'); } else { $(".buttonUp").removeClass('top'); } } function initCalendar () { if($(".mod_calendar").length>0){ var fun = function(){ if($(".date-picker-table caption").length<1) $(".date-picker-table").prepend("