This commit is contained in:
Andre Beging
2020-03-05 16:54:34 +01:00
commit 3ad32d10b5
153 changed files with 49920 additions and 0 deletions

82
public/js/agency.js Normal file
View File

@@ -0,0 +1,82 @@
// Smooth scrolling via animate()
$(document).ready(function(){
if ($('.g-recaptcha')) {
checkReCaptcha()
}
$("a").on('click', function(event) {
if (this.hash && window.location.pathname == "/") {
event.preventDefault();
var hash = this.hash;
$('html, body').animate({
scrollTop: $(hash).offset().top
}, 800, function(){
window.location.hash = hash;
});
}
});
// Navigation change on scroll
var maxOffset = 50;
$(window).scroll(function() {
if ($(window).scrollTop() >= maxOffset) {
$('.navbar-default').addClass('navbar-shrink');
}
else {
$('.navbar-default').removeClass('navbar-shrink');
}
});
var maxOffset = 50;
if ($(window).scrollTop() >= maxOffset) {
$('.navbar-default').addClass('navbar-shrink');
}
else {
$('.navbar-default').removeClass('navbar-shrink');
}
});
// Highlight the top nav as scrolling occurs
$('body').scrollspy({
target: '.navbar-fixed-top'
})
// Closes the Responsive Menu on Menu Item Click
$('.navbar-collapse ul li a').click(function() {
$('.navbar-toggle:visible').click();
});
// Async contact form
$('form[id=contactForm]').submit(function(){
$.post($(this).attr('action'), $(this).serialize(), function(data, textStatus, jqXHR){
$('form[id=contactForm] #success').hide();
$('form[id=contactForm] #error').hide();
if (jqXHR.status == 200) {
$('form[id=contactForm] #success').show();
}}, 'json').fail(function(){
$('form[id=contactForm] #success').hide();
$('form[id=contactForm] #error').hide();
$('form[id=contactForm] #error').show();
});
return false;
});
// Contact form validation
//$.validate({
// modules : 'html5, toggleDisabled'
//});
function onContactCaptcha($form) {
$('form#contactForm').submit();
}
function checkReCaptcha() {
if (typeof grecaptcha === "undefined") {
$('.captcha-error').show();
setTimeout(checkReCaptcha, 200);
} else {
$('.captcha-error').hide();
$('.g-recaptcha-filler').hide();
$('.g-recaptcha').attr('disabled', true);
}
}