Code:
jQuery(function ($) {
$(document).ready(function () {
// Highlight the top nav as scrolling occurs
$('body').scrollspy({
target: '.navbar-fixed-top'
});
// jQuery for page scrolling feature - requires jQuery Easing plugin
$(function () {
$('a.page-scroll').bind('click', function (event) {
var $anchor = $(this);
$('html, body').stop().animate({
scrollTop: $($anchor.attr('href')).offset().top
}, 1500, 'easeInOutExpo');
event.preventDefault();
});
});
$(function () {
$('a[href*=#]:not([href=#])').click(function () {
if (location.pathname.replace(/^\//, '') == this.pathname.replace(/^\//, '') && location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
if (target.length) {
$('html,body').animate({
scrollTop: target.offset().top
}, 1000);
return false;
}
}
});
});
$(".asdfjkl").bind('scroll', function () {
var fixHeight = $(window).width() > 768 ? 239 : 80;
if ($(window).scrollTop() > fixHeight) {
$('.navbar').addClass('navbar-fixed-top');
$("main .container").addClass("menu-fixed");
$("#contact-wrapper").show();
} else {
$('.navbar').removeClass('navbar-fixed-top');
$("main .container").removeClass("menu-fixed");
$("#contact-wrapper").hide();
}
/* Check the location of each desired element */
$('.fadeinscroll').each(function (i) {
var offset = 150;
var bottom_of_object = $(this).offset().top + $(this).outerHeight();
var bottom_of_window = $(window).scrollTop() + $(window).height();
/* If the object is completely visible in the window, fade it it */
if ((bottom_of_window + offset) > bottom_of_object) {
$(this).animate({'opacity': '1'}, 500);
}
});
});
});
});
function validateEmail(email) {
var re = /^(([^<>()[\]\\.,;:\s@"]+(\.[^<>()[\]\\.,;:\s@"]+)*)|(".+"))@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}])|(([a-zA-Z\-0-9]+\.)+[a-zA-Z]{2,}))$/;
return re.test(email);
}