// JavaScript Document (function($) { $(document).ready(function(e) { if($(".single-post").length >0 || $(".page-template-template-downloadfile").length >0){ // Find all YouTube videos var $allVideos = $("iframe[src*='//player.vimeo.com'], iframe[src*='//www.youtube.com'], iframe[src*='//www.youtube-nocookie.com']"); // The element that is fluid width if($(".single-post").length >0){ $fluidEl = $(".entry-content"); } else { $fluidEl = $(".vc_col-sm-6"); } // Figure out and save aspect ratio for each video $allVideos.each(function() { $(this) .data('aspectRatio', $(this).height() / $(this).width()) // and remove the hard coded width/height .removeAttr('height') .removeAttr('width'); console.log($(this).height() / $(this).width()); }); function resize_video(){ var newWidth = $fluidEl.width(); console.log(newWidth); // Resize all videos according to their own aspect ratio $allVideos.each(function() { var $el = $(this); $el .width(newWidth) .height(newWidth * $el.data('aspectRatio')); }); } resize_video(); // When the window is resized $(window).resize(function() { resize_video(); // Kick off one resize to fix all videos on page load }) } $('.header-v3 #search-btn').click(function(){ $('#search-top').stop(true,true).fadeIn(100); $('#logo-navigation, .header-icons-divider').stop().animate({'opacity' : 0}, 100); $('#search-top input[type=text]').focus(); return false; }); function goToByScroll(id){ // Remove "link" from the ID $('html,body').animate({ scrollTop: $("#"+id).offset().top}, 'slow'); } function goToByScrollClass(id){ // Remove "link" from the ID $('html,body').animate({ scrollTop: $("."+id).offset().top}, 'slow'); } var settings = { toggle: "#sliiider-toggle", // the selector for the menu toggle, whatever clickable element you want to activate or deactivate the menu. A click listener will be added to this element. exit_selector: ".slider-exit", // the selector for an exit button in the div if needed, when the exit element is clicked the menu will deactivate, suitable for an exit element inside the nav menu or the side bar animation_duration: "0.5s", //how long it takes to slide the menu place: "right", //where is the menu sliding from, possible options are (left | right | top | bottom) animation_curve: "cubic-bezier(0.54, 0.01, 0.57, 1.03)", //animation curve for the sliding animation body_slide: false, //set it to true if you want to use the effect where the entire page slides and not just the div no_scroll: true, //set to true if you want the scrolling disabled while the menu is active }; $('#menu-sandwitch').sliiide(settings); //initialize sliiide $("#sliiider-toggle").click(function(e) { $(".interno-menuslider").css("visibility","visible"); }); if($(".home").length >0 ){ imagepreview(); } function imagepreview(){ xOffset = 50; yOffset = 75; $("a.preview").hover(function(e){ $imageprev = $(this).parent("li").data("image"); $("body").append("
"); $("#preview") .css("top",(e.pageY - xOffset) + "px") .css("left",(e.pageX + yOffset) + "px") .fadeIn("fast"); }, function(){ $("#preview").remove(); }); $("a.preview").mousemove(function(e){ $("#preview") .css("top",(e.pageY - xOffset) + "px") .css("left",(e.pageX + yOffset) + "px"); }); } if($(".single-portfolio").length > 0){ /*$(".prestazione-block").accordion({ collapsible: true });*/ $("#ui-tabs-nav").tabs(); /*$("#prestazio").accordion({ collapsible: true });*/ $(".tecnics-block").accordion({ collapsible: true /* active: false, collapsible: true*/ }); /*$(".accessori-block").accordion({ collapsible: true });*/ $(".contenitor-plus img").hover(function(){ $(".contenitore-desc").html(""); $testo = $(this).next(".no-text").html(); $(".contenitore-desc").html($testo); }, function(){ $(".contenitore-desc").html(""); } ); var target_flexslider = $('.flexslider'); target_flexslider.flexslider({ selector: ".slides > li", animation: "slide", prevText: "", nextText: "", animation: 'easeOutQuad', useCSS: false, smoothHeight: true, pauseOnHover: true, animationSpeed: 600, start: function(slider) { $(".spinner4").hide("fast"); $(".backgroun-container-flex").removeClass("loading"); } }); /*$(".ui-tabs-anchor").click(function(e) { $datae = $(this).data("energy").toLowerCase(); console.log($datae); if($datae == "a+"){ $(".arrow_box_energy").hide(0); $(".nascontiaplus").show(0); } else { $(".nascontiaplus").hide(0); $oldClass = $(".arrow_box_energy").attr("class"); console.log($(".arrow_box_energy").attr("class")); $(".arrow_box_energy").removeClass($oldClass[1]).addClass("letter_" + $datae).show(0); $(".arrow_box_energy .logo_letter").html($(this).data("energy")); } });*/ /*$(".contenitor-plus img").on("mouseover",function(){ $(".contenitore-desc").html(""); $testo = $(this).next(".no-text"); $(".contenitore-desc").html($testo); });*/ } if($(".page-template-template-faq").length > 0){ $("#faq").accordion({ /*active: false,*/ collapsible: true, heightStyle: "content", autoHeight: false, clearStyle: true }); } if($(".page-template-template-documenti").length > 0){ $("#submit-cap").click(function(e) { $(".iconspinner").show("fast"); e.preventDefault(); $valoreCap = $("#capform").val(); $("#capform").val(""); $("#contenitore-assistenza").html(""); visualizza_docu($valoreCap); }); function visualizza_docu($cap){ var data = { action: action, cap: $cap }; $.ajax({ type: 'POST', url: ajax_url_CAP, data: data, success: function(response){ if(response){ try { $(".iconspinner").hide("fast"); ridisegnaDocu(response); } catch(err) { console.log(err); } } } }); } } }); })(jQuery);