//SMOOTH SCROLLING $(function() { $('a[href*="#"]:not(.tab)').click(function() { var winTop = $(window).scrollTop(); var sectionOneTop = $(".descripcion").offset().top; if (winTop < sectionOneTop) { if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); if (target.length) { $('html, body').animate({ scrollTop: target.offset().top -288 }, 1000); return false; } } } else { if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'') && location.hostname == this.hostname) { var target = $(this.hash); target = target.length ? target : $('[name=' + this.hash.slice(1) +']'); if (target.length) { $('html, body').animate({ scrollTop: target.offset().top -144 }, 1000); return false; } } } }); }); //NAVBAR COLLAPSE CLOSE ON CLICK $(".collapse ul li a").click(function(){ $(this).closest(".collapse").removeClass("in"); }); //Validación de formulario $(".contacto button").click(function(){ if( $("#contactName").val() === "" ) { $("#contactName").addClass("error"); } else { $("#contactName").removeClass("error"); }; if( $("#mail").val() === "" ) { $("#mail").addClass("error"); } else { $("#mail").removeClass("error"); }; if( $("#tel").val() === "" ) { $("#tel").addClass("error"); } else { $("#tel").removeClass("error"); }; if( $("#mensaje").val() === "" ) { $("#mensaje").addClass("error"); } else { $("#mensaje").removeClass("error"); } }) //Slick $(document).ready(function(){ $('.equipo-carousel').slick({ //setting-name: setting-value slidesToShow: 2, slidesToScroll: 1, responsive: [ { breakpoint: 768, settings: { slidesToShow: 2, slidesToScroll: 2 } }, { breakpoint: 480, settings: { slidesToShow: 1, slidesToScroll: 1 } } // You can unslick at a given breakpoint now by adding: // settings: "unslick" // instead of a settings object ] }); $('.especificaciones-tradicional').slick({ //setting-name: setting-value slidesToShow: 4, slidesToScroll: 4, responsive: [ { breakpoint: 768, settings: { slidesToShow: 2, slidesToScroll: 2 } }, { breakpoint: 480, settings: { slidesToShow: 1, slidesToScroll: 1 } } // You can unslick at a given breakpoint now by adding: // settings: "unslick" // instead of a settings object ] }); $('.especificaciones-rich').slick({ //setting-name: setting-value slidesToShow: 3, slidesToScroll: 3, responsive: [ { breakpoint: 768, settings: { slidesToShow: 2, slidesToScroll: 2 } }, { breakpoint: 480, settings: { slidesToShow: 1, slidesToScroll: 1 } } // You can unslick at a given breakpoint now by adding: // settings: "unslick" // instead of a settings object ] }); }); //Hover Effect $(function() { $(' #team .miembro ').each( function() { $(this).hoverdir(); } ); }); //First Section function firstMTop() { var winHeight = $(window).height(); //$(".nav-main").css("margin-top", winHeight); function foffset() { var windowOffset = $(window).scrollTop(); var firstOffset = $(".nav-main").offset().top - 21; if (windowOffset > winHeight) { $(".nav-top").addClass("nav-top-min"); $(".nav-main").addClass("nav-main-fix"); } else { $(".nav-top").removeClass("nav-top-min"); $(".nav-main").removeClass("nav-main-fix"); } } $(document).ready(foffset); $(window).scroll(foffset); } $(document).ready(firstMTop); $(window).resize(firstMTop); //$(window).scroll(firstMTop); //VIDEO (function(){ function id(v){return document.getElementById(v); } function loadbar() { var ovrl = id("overlay"), prog = id("progress"), stat = id("progstat"), img = document.images, c = 0; tot = img.length; function imgLoaded(){ c += 1; var perc = ((100/tot*c) << 0) +"%"; prog.style.width = perc; stat.innerHTML = "Loading "+ perc; if(c===tot) return doneLoading(); } function doneLoading(){ ovrl.style.opacity = 0; setTimeout(function(){ ovrl.style.display = "none"; }, 1200); } for(var i=0; i= loops) { // remove the interval $self.removeData('countTo'); clearInterval(data.interval); value = settings.to; if (typeof(settings.onComplete) == 'function') { settings.onComplete.call(self, value); } } } function render(value) { var formattedValue = settings.formatter.call(self, value, settings); $self.html(formattedValue); } }); }; $.fn.countTo.defaults = { from: 0, // the number the element should start at to: 0, // the number the element should end at speed: 1000, // how long it should take to count between the target numbers refreshInterval: 100, // how often the element should be updated decimals: 0, // the number of decimal places to show formatter: formatter, // handler for formatting the value before rendering onUpdate: null, // callback method for every time the element is updated onComplete: null // callback method for when the element finishes updating }; function formatter(value, settings) { return value.toFixed(settings.decimals); } }(jQuery)); jQuery(function ($) { // custom formatting example $('.count-number').data('countToOptions', { formatter: function (value, options) { return value.toFixed(options.decimals).replace(/\B(?=(?:\d{3})+(?!\d))/g, '.'); } }); // start all the timers $('.timer').each(count); function count(options) { var $this = $(this); options = $.extend({}, options || {}, $this.data('countToOptions') || {}); $this.countTo(options); } }); }); // GRÁFICO var firedChart = false; $(document).ready(function(){ $('#myChart').appear().on('appear', function() { if (firedChart === false) { //1 //var ctx = document.getElementById("myChart"); //var myChart = new Chart(ctx, { // type: 'doughnut', // data: { // legend: { // display: true, // labels: { // fontColor: 'rgb(255, 99, 132)' // } // }, //labels: [ // "ABC1", // "C2", // "C3", //"D1", //"D2" //], //datasets: [ // { // data: [37, 25, 24, 7, 3], // backgroundColor: [ // "#FF6384", // "#36A2EB", //"#FFCE56", //"#66d107", //"#d1025e" //], //hoverBackgroundColor: [ // "#FF6384", //"#36A2EB", //"#FFCE56", //"#50a505", //"#ff0072" //] //}] //}, //options: { //labels: { // position: "bottom", //}, //legend: { // position: "bottom", //display: false //}, //animation: { //duration: 1200, //} //} //}); //2 var ctx = document.getElementById("myChartB"); var myChartB = new Chart(ctx, { type: 'doughnut', data: { legend: { display: true, labels: { fontColor: 'rgb(255, 99, 132)' } }, labels: [ "Hombre", "Mujer" ], datasets: [ { data: [61, 39], backgroundColor: [ "#36A2EB", "#FF6384" ], hoverBackgroundColor: [ "#36A2EB" , "#FF6384" ] }] }, options: { labels: { position: "bottom", display: false }, legend: { position: "bottom", display: false }, animation: { duration: 1200, } } }); //3 var ctx = document.getElementById("myChartC"); var myChartC = new Chart(ctx, { type: 'doughnut', data: { legend: { display: true, labels: { fontColor: 'rgb(255, 99, 132)' } }, labels: [ "18-24", "25-34", "35-44", "45-54", "55-64", "65+" ], datasets: [ { data: [13.26, 23.58, 20.94, 13.20, 14, 15.02], backgroundColor: [ "#FF6384", "#36A2EB", "#FFCE56", "#66d107", "#d1025e", "#FF4000" ], hoverBackgroundColor: [ "#FF6384", "#36A2EB", "#FFCE56", "#50a505", "#ff0072", "#FF4000" ] }] }, options: { labels: { position: "bottom", }, legend: { position: "bottom", display: false }, animation: { duration: 1200, } } }); firedChart = true; } }) }); //BANNERS var sectionAScrollTop = 1; var sectionBScrollTop = 1; function openWork(){ var add = 1; //Close Hide $(document).ready(function(){ var counter = 1; $(".especificaciones-item div a").click(function(){ setTimeout(function(){ $(document).scroll(function(){ var winScrollTop = $(window).scrollTop(); var sectionBScrollTop = $("#especificaciones-detail").offset().top - 140; var sectionAScrollTop = $(".equipo").offset().top; if((winScrollTop > sectionBScrollTop) && (winScrollTop < sectionAScrollTop)){ $(".close-espec").show(); } else { $(".close-espec").hide(); } }); }, 2000); var addIndex = $(this).closest("li").attr('data-slick-index'); var add = addIndex; var aAcount = $(this).attr("data-slick-index"); var url = "espec/t-banner-" + add + ".html"; $("#especificaciones-detail > div").remove(); $("#especificaciones-detail").append("
"); if ($(this).parents().hasClass('tradicionales')) { var url = "espec/tradicional/banner-" + add + ".html"; } else if ($(this).parents().hasClass('rich-media')) { var url = "espec/rich/banner-" + add + ".html"; } else { var url = "espec/otros/banner-" + add + ".html"; }; $.ajax( { url: url, type: "GET", cache: false, success: function(html) { $("#especificaciones-detail div").html(html); } }); $( "#especificaciones-detail" ).slideDown( "slow" ); $('html, body').animate({ scrollTop: $("#especificaciones-detail").offset().top - 140 }, 1000); }); }); } openWork(); var ass = true; $(document).ready(function(){ $(".close-espec").click(function(){ $(this).siblings().remove(); $('html, body').animate({ scrollTop: $(".especificaciones").offset().top }, 500); }); });