/home/vianto5/ceibaresidencial.mx/assets/js
Edit: /home/vianto5/ceibaresidencial.mx/assets/js/main.js (9092B)
(function ($) {
"use strict";
jQuery(document).ready(function ($) {
// offcanvas-menu
// click-action
$(".bar").on("click", function () {
$(".offcamva, .overlay").addClass("active");
return false;
});
$(".cross").on("click", function () {
$(".offcamva, .overlay").removeClass("active");
});
$(".overlay").on("click", function () {
$(".offcamva, .overlay").removeClass("active");
});
$(".galery-slider").owlCarousel({
items: 1,
nav: true,
dot: false,
loop: true,
margin: 20,
navText: ['
', '
'],
autoplay: false,
autoplayTimeout: 3000,
smartSpeed: 1000,
responsiveClass: true,
responsive: {
0: {
items: 1,
},
768: {
items: 1,
},
1000: {
items: 1,
}
}
});
$(".hero-actv").owlCarousel({
items: 1,
nav: true,
dot: true,
loop: true,
margin: 20,
navText: ['
', '
'],
autoplay: false,
autoplayTimeout: 3000,
smartSpeed: 1000,
responsiveClass: true,
responsive: {
0: {
items: 1,
},
768: {
items: 1,
},
1000: {
items: 1,
}
}
});
if ($('.venobox').length > 0){
$('.venobox').venobox();
}
$.fn.inputFilter = function(inputFilter) {
return this.on("input keydown keyup mousedown mouseup select contextmenu drop", function() {
if (inputFilter(this.value)) {
this.oldValue = this.value;
this.oldSelectionStart = this.selectionStart;
this.oldSelectionEnd = this.selectionEnd;
} else if (this.hasOwnProperty("oldValue")) {
this.value = this.oldValue;
this.setSelectionRange(this.oldSelectionStart, this.oldSelectionEnd);
} else {
this.value = "";
}
});
};
$(".numbers-only").inputFilter(function(value) {
return /^\d*$/.test(value); // Allow digits only, using a RegExp
});
var getUrlParameter = function getUrlParameter(sParam) {
var sPageURL = window.location.search.substring(1),
sURLVariables = sPageURL.split('&'),
sParameterName,
i;
for (i = 0; i < sURLVariables.length; i++) {
sParameterName = sURLVariables[i].split('=');
if (sParameterName[0] === sParam) {
return typeof sParameterName[1] === undefined ? true : decodeURIComponent(sParameterName[1]);
}
}
return false;
};
window.addEventListener('load', function() {
var forms = document.getElementsByClassName('needs-validation');
var validation = Array.prototype.filter.call(forms, function(form) {
form.addEventListener('submit', function(event) {
event.preventDefault();
event.stopPropagation();
if (form.checkValidity() === false) {
event.preventDefault();
event.stopPropagation();
} else{
event.preventDefault();
sendMailController(form);
}
form.classList.add('was-validated');
}, false);
});
}, false);
var sendMailController = function(frm) {
var form = $('#contact-form');
var src_var = getUrlParameter('utm_source');
$('#staticBackdrop').modal("hide");
$('#spinnerModal').modal("show");
$.ajax({
type: form.attr("method"),
url: form.attr("action"),
data: {
name: frm.getElementsByClassName("txt-name")[0].value,
phone: frm.getElementsByClassName("txt-phone")[0].value,
email: frm.getElementsByClassName("txt-email")[0].value,
term: frm.getElementsByClassName("txt-term")[0].options[frm.getElementsByClassName("txt-term")[0].selectedIndex].text,
budget: frm.getElementsByClassName("txt-budget")[0].options[frm.getElementsByClassName("txt-budget")[0].selectedIndex].text,
msg: frm.getElementsByClassName("txt-msg")[0].value,
interest: frm.getElementsByClassName("txt-interest")[0].options[frm.getElementsByClassName("txt-interest")[0].selectedIndex].text,
dev: frm.getElementsByClassName("txt-development")[0].value,
src: src_var
},
dataType: "json",
success: function(data) {
$('.txt-name').val("");
$('.txt-phone').val("");
$('.txt-email').val("");
$('.txt-term').val("");
$('.txt-budget').val("");
$('.txt-msg').val("");
$('.txt-interest').val("");
form.removeClass('was-validated');
if(data.success){
$('#spinnerModal').modal("hide");
$('#formError .msg-ajax').text(data.msg);
$('#formError').modal("show");
} else{
$('#spinnerModal').modal("hide");
$('#formError .msg-ajax').text(data.msg);
$('#formError').modal("show");
}
},
error: function(data){
$('#spinnerModal').modal("hide");
$('#formError .msg-ajax').text('Tu solicitud no pudo ser procesada, inténtalo nuevamente más tarde por favor.');
$('#formError').modal("show");
$('.txt-name').val("");
$('.txt-phone').val("");
$('.txt-email').val("");
$('.txt-term').val("");
$('.txt-budget').val("");
$('.txt-msg').val("");
$('.txt-interest').val("");
form.removeClass('was-validated');
}
});
}
});
// responsive nav
$(window).bind("scroll", (function() {
$(window).scrollTop() > 50 ? $(".navigation-wrap").addClass("fixed-top") : $(".navigation-wrap").removeClass("fixed-top")
}
)),
$.fn.basicResponsiveMenu = function(e) {
function a() {
return self.innerWidth ? self.innerWidth : document.documentElement && document.documentElement.clientWidth ? document.documentElement.clientWidth : document.body ? document.body.clientWidth : void 0
}
function t() {
$(".response--main-navigation").addClass("mobile-nav"),
!0 === e.animate && $(".response--main-navigation .response--site-menu").css({
transition: e.slideSpeed + "ms"
}),
$(".response--main-navigation").children("button.show-nav").length,
0 === $(".response--site-menu").children("button.hide-nav").length && ($(".response--site-menu").prepend('

')
// $(".response--site-menu").append('

')
// $(".response--site-menu").append('

')
)
}
"left" === (e = $.extend({}, {
browserWidth: 1920,
animate: !0,
slideDir: "right",
slideSpeed: 250
}, e)).slideDir ? $(".response--main-navigation").addClass("slideLeft").removeClass("slideRight") : $(".response--main-navigation").addClass("slideRight").removeClass("slideLeft"),
a() <= e.browserWidth && (t(),
$(".show-nav").on("click", (function() {
$(".response--main-navigation").addClass("expanded"),
$("body").css({
height: "100vh",
"overflow-y": "hidden"
})
}
)),
$(".hide-nav").on("click", (function() {
$(".response--main-navigation").removeClass("expanded"),
$("body").css({
height: "auto",
"overflow-y": "visible"
})
}
))),
$(window).resize((function() {
a() <= e.browserWidth ? ($(".response--main-navigation").removeClass("web-nav"),
t(),
$("button.show-nav").on("click", (function() {
$(".response--main-navigation").addClass("expanded"),
$("body").css({
height: "100vh",
"overflow-y": "hidden"
})
}
)),
$("button.hide-nav").on("click", (function() {
$(".response--main-navigation").removeClass("expanded"),
$("body").css({
height: "auto",
"overflow-y": "visible"
})
}
))) : ($(".response--main-navigation").addClass("web-nav"),
$(".response--main-navigation").removeClass("mobile-nav"),
$(".response--main-navigation").removeClass("expanded"),
$("button.show-nav").remove(),
$("button.hide-nav").remove())
}
))
}
,
$((function() {
$(".response--main-navigation").basicResponsiveMenu({
slideDir: "left",
slideSpeed: 250,
browserWidth: 20000,
animate: !0
})
}
));
// color transition nav
window.onscroll = function() {scrollFunction()};
function scrollFunction() {
if (document.body.scrollTop > 1 || document.documentElement.scrollTop > 1 && window.innerWidth > 901) {
document.getElementById("navigation").classList.add('scrolled-nav');
// document.getElementById("iconos-lateral").style.top = "90%";
document.getElementById("iconos-lateral").classList.add('align-logos');
// document.getElementById("header-wrap").classList.remove('pad-top-nav');
} else {
// document.getElementById("header-wrap").style.background = "transparent";
document.getElementById("navigation").classList.remove('scrolled-nav');
document.getElementById("iconos-lateral").classList.remove('align-logos');
if(window.innerWidth < 900){
document.getElementById("navigation").classList.add('scrolled-nav');
document.getElementById("iconos-lateral").classList.add('align-logos');
// document.getElementById("header-wrap").classList.remove('pad-top-nav');
}
}
}
// end color transition
jQuery(window).load(function () {
});
}(jQuery));