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.
86 lines
2.0 KiB
JavaScript
86 lines
2.0 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();
|
|
}
|
|
|
|
$("[name='mainMenu']").click(function () {
|
|
this.href = this.href.replace("dummy", $('#condominios').val());
|
|
});
|
|
}); |