You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
executaveis/GCI.PortalCondomino/wwwroot/js/site.js

111 lines
2.7 KiB
JavaScript

/* Scripts genéricos do site */
function alertTimeout(wait) {
setTimeout(function () {
$('.alert').remove();
}, wait);
}
$(function () {
if ($('.alert').length) {
scrollOrcamento();
}
alertTimeout(3000);
});
/* REDUZIR BARRA DE NAVEGAÇÂO AO FAZER SCROLL
----------------------------------------------------------------------------------------------------*/
$(window).scroll(function () {
if ($(document).scrollTop() > 450) {
$('#main-menu').addClass('shrink');
} else {
$('#main-menu').removeClass('shrink');
}
});
/* LINKS DO MENU PRINCIPAL COM SCROLL PARA O CONTEÚDO
----------------------------------------------------------------------------------------------------*/
function scrollToSection(sectionID) {
$('html, body').animate({
scrollTop: $('#' + sectionID).offset().top - 60
}, 1000);
}
/* LINKS PARA EXPANDIR O FOMRUlÀRIO DE ORÇAMENTO E FAZER SCROLL
----------------------------------------------------------------------------------------------------*/
function scrollOrcamento() {
$('#collapseForm').collapse('show');
$('html, body').animate({
scrollTop: $("#formulario").offset().top - 60
}, 1000);
}
/* https://stackoverflow.com/a/9805747 */
var jump = function (e) {
var target = '';
if (e) {
e.preventDefault();
target = $(this).attr("href");
} else {
target = location.hash;
}
if (target === '#formulario') {
$('#collapseForm').collapse('show');
}
if (target !== '#collapseForm') {
$('html,body').animate({
scrollTop: $(target).offset().top - 60
}, 1000, function () {
history.pushState("", document.title, window.location.pathname + window.location.search);
});
}
}
$('html, body, .toggleable').hide();
$(document).ready(function () {
$('a[href^=\\#]').bind("click", jump);
if (location.hash) {
setTimeout(function () {
$('html, body').scrollTop(0).show();
jump();
}, 0);
} else {
$('html, body').show();
}
$("#commonhold").change(function () {
this.form.submit();
});
$(".scroll-hero").click(function () {
scrollToSection('hero');
$(".navbar-collapse.in").collapse('hide');
});
$(".scroll-quem-somos").click(function () {
scrollToSection('quem-somos');
$(".navbar-collapse.in").collapse('hide');
});
$(".scroll-servicos").click(function () {
scrollToSection('servicos');
$(".navbar-collapse.in").collapse('hide');
});
$(".scroll-main-footer").click(function () {
scrollToSection('main-footer');
$(".navbar-collapse.in").collapse('hide');
});
$(".scroll-orcamento").click(function () {
scrollOrcamento();
$(".navbar-collapse.in").collapse('hide');
});
});