var tokenCaptcha = '';
(function ($, window, document, undefined) {
'use strict';
$(document).ready(function() {
$("[data-fancybox]").fancybox({
helpers : {
overlay : {
css : {
'background' : 'rgba(58, 42, 45, 0.95)'
}
}
}
});
// Parallax Background
jQuery('.contact-parallax').parallax;
// Owl Carousel
jQuery("#ws-items-carousel").owlCarousel({
items :4,
navigation : true
});
jQuery("#ws-noticias-carousel").owlCarousel({
items :1,
navigation : true
});
// Products Carousel
jQuery("#ws-products-carousel").owlCarousel({
navigation : true,
slideSpeed : 300,
paginationSpeed : 400,
singleItem:true
});
// Page Loader
jQuery("#preloader").delay(1500).fadeOut(500);
// Scroll Reveal
window.sr = new scrollReveal();
grecaptcha.ready(function() {
getTokenCaptcha();
});
setInterval(function(){
getTokenCaptcha();
}, 60000);
// formularios
$('.ajax-form').submit(function(e){
e.preventDefault();
console.log('submit');
var form=this;
var boton=$(this).find(".button");
var msg_div=$(this).find('.contact-msg');
var valor_boton=boton.val();
$('body').css('cursor','wait');
boton.attr('disabled','disabled');
msg_div.hide('fast');
$(form).prepend('');
$.ajax({
type: form.method,
url: form.action,
timeout: 30000,
data: $(form).serialize()
}).done(function(valor) {
console.log(valor);
var obj = valor;
if(obj.send==1){ //enviado
msg_div.html(''+obj.message+'').show('fast');
resetForm($(form));
}else{
msg_div.html(''+obj.message+'').show('fast');
}
}).fail(function() {
msg_div.html('Error al enviar').show('fast');boton.removeAttr('disabled');
});
boton.removeAttr('disabled');
$('body').css('cursor','auto');
return false;
});
// Hero Image
jQuery("#ws-hero").show().revolution({
sliderType:"hero",
jsFileLocation:"assets/js/plugins/revolution/js/",
fullScreenOffsetContainer:".ws-header-static,.ws-topbar",
sliderLayout:"fullscreen",
dottedOverlay:"none",
delay:9000,
navigation: {
},
responsiveLevels:[1240,1024,778,480],
gridwidth:[1240,1024,778,480],
gridheight:[600,500,400,300],
lazyType:"none",
parallax: {
type:"mouse",
origo:"slidercenter",
speed:1000,
levels:[2,3,4,5,6,7,12,16,10,50],
},
shadow:0,
spinner:"off",
autoHeight:"off",
disableProgressBar:"on",
hideThumbsOnMobile:"off",
hideSliderAtLimit:0,
hideCaptionAtLimit:0,
hideAllCaptionAtLilmit:0,
debugMode:false,
fallbacks: {
simplifyAll:"off",
disableFocusListener:false,
}
});
// Hero FullScreen
jQuery("#ws-hero-fullscreen").show().revolution({
sliderType:"hero",
jsFileLocation:"assets/js/plugins/revolution/js/",
fullScreenOffsetContainer:".ws-topbar",
sliderLayout:"fullscreen",
dottedOverlay:"none",
delay:9000,
navigation: {
},
responsiveLevels:[1240,1024,778,480],
gridwidth:[1240,1024,778,480],
gridheight:[600,500,400,300],
lazyType:"none",
parallax: {
type:"mouse",
origo:"slidercenter",
speed:1000,
levels:[2,3,4,5,6,7,12,16,10,50],
},
shadow:0,
spinner:"off",
autoHeight:"off",
disableProgressBar:"on",
hideThumbsOnMobile:"off",
hideSliderAtLimit:0,
hideCaptionAtLimit:0,
hideAllCaptionAtLilmit:0,
debugMode:false,
fallbacks: {
simplifyAll:"off",
disableFocusListener:false,
}
});
// Fullscreen Slider
jQuery("#ws-fullscreen-slider").revolution({
sliderType:"standard",
fullScreenOffsetContainer:".ws-topbar",
sliderLayout:"fullscreen",
delay:9000,
navigation: {
arrows:{enable:true}
},
gridwidth:1230,
spinner:"off",
disableProgressBar:"on",
gridheight:720
});
// Fullwidth
jQuery("#ws-fullwidth-slider").revolution({
sliderType:"standard",
fullScreenOffsetContainer:".ws-topbar",
sliderLayout:"fullscreen",
delay:9000,
navigation: {
arrows:{enable:true}
},
gridwidth:1230,
spinner:"off",
disableProgressBar:"on",
fullWidth:"on",
forceFullWidth:"on",
gridheight:500
});
// 3D Parallax Slider
jQuery("#ws-3d-parallax").show().revolution({
sliderType: "hero",
fullScreenOffsetContainer:".ws-topbar, .ws-header-static",
jsFileLocation: "assets/js/plugins/revolution/js/",
sliderLayout: "fullscreen",
dottedOverlay: "none",
delay: 9000,
navigation: {},
responsiveLevels: [1240, 1024, 778, 480],
visibilityLevels: [1240, 1024, 778, 480],
gridwidth: [1400, 1240, 778, 480],
gridheight: [768, 768, 960, 720],
lazyType: "none",
parallax: {
type: "3D",
origo: "slidercenter",
speed: 1000,
levels: [5, 10, 15, 20, 25, 30, 5, 0, 45, 50, 47, 48, 49, 50, 51, 55],
ddd_shadow: "off",
ddd_bgfreeze: "off",
ddd_overflow: "hidden",
ddd_layer_overflow: "visible",
ddd_z_correction: 65,
},
spinner: "off",
autoHeight: "off",
disableProgressBar: "on",
hideThumbsOnMobile: "off",
hideSliderAtLimit: 0,
hideCaptionAtLimit: 0,
hideAllCaptionAtLilmit: 0,
debugMode: false,
fallbacks: {
simplifyAll: "off",
disableFocusListener: false,
}
});
});
})(jQuery, window, document);
function slideSwitch_marcas1() {
var $active = $('#slideshow_marcas1 DIV.active');
if ( $active.length == 0 ) $active = $('#slideshow_marcas1 DIV:last');
var $next = $active.next().length ? $active.next()
: $('#slideshow_marcas1 DIV:first');
$active.addClass('last-active');
$next.css({opacity: 0.0})
.addClass('active')
.animate({opacity: 1.0}, 400, function() {
$active.removeClass('active last-active');
});
}
$(function() {
setInterval( "slideSwitch_marcas1()", 5000 );
});
function resetForm($form){
$form.find('input:text, input:password, input:file, select, textarea, input[type="email"]').val('');
$form.find('input:radio, input:checkbox').removeAttr('checked').removeAttr('selected');
}
function getTokenCaptcha(){
grecaptcha.execute('6LdvyoAjAAAAAMsqRzemLJB1KvQKjcUIreSJZ1NY', {action: 'homepage'}).then(function(token) {
tokenCaptcha = token;
});
}