$(document).ready(function() {
/* Header */
$('#header').addClass('full');
switchHeader();
$(window).scroll(function() {
$('#header').removeClass('full');
switchHeader();
});
/* Page Scroll */
$('#header a[href = "/"]').click(function() {
$('html, body').animate({
scrollTop: 0
}, 300, 'easeInOutCirc');
return false;
});
$('#header ul li a').click(function() {
var anchor = $(this).attr('href');
$('html, body').animate({
scrollTop: $(anchor).offset().top
}, 300, 'easeInOutCirc');
return false;
});
/* Works/Map Hover */
$('#works ul li a, #contact ul li:first a').hover(
function() {
$(this).find('h3, p').fadeIn(150);
}, function() {
$(this).find('h3, p').fadeOut(150);
});
});
function switchHeader() {
if (document.documentElement.clientWidth <= 480) {
if ($(window).scrollTop() <= 35) {
$('#header').addClass('full');
}
} else {
if ($(window).scrollTop() <= 180) {
$('#header').addClass('full');
}
}
$('#header ul li a').removeClass('current').each(function(index) {
var section = $(this).attr('href');
if ($(window).scrollTop() >= $(section).offset().top) {
$('#header ul li a').removeClass('current');
$('#header ul li a[href=' + section + ']').addClass('current');
}
if ($(window).scrollTop() + $(window).height() == $(document).height()) {
$('#header ul li a').removeClass('current');
$('#header ul li a:last').addClass('current');
}
});
}
$(document).ready(function() {
/* Header */
$('#header').addClass('full');
switchHeader();
$(window).scroll(function(){
$('#header').removeClass('full');
switchHeader();
});
/* Page Scroll */
$('#header a[href = "/"]').click(function (){
$('html, body').animate({scrollTop : 0}, 300, 'easeInOutCirc');
return false;
});
$('#header ul li a').click(function (){
var anchor = $(this).attr('href');
$('html, body').animate({scrollTop: $(anchor).offset().top}, 300, 'easeInOutCirc');
return false;
});
/* Works/Map Hover */
$('#works ul li a, #contact ul li:first a').hover(
function () {
$(this).find('h3, p').fadeIn(150);
},
function () {
$(this).find('h3, p').fadeOut(150);
}
);
});
function switchHeader(){
if (document.documentElement.clientWidth <= 480){
if ($(window).scrollTop() <= 35){
$('#header').addClass('full');
}
} else {
if ($(window).scrollTop() <= 180){
$('#header').addClass('full');
}
}
$('#header ul li a').removeClass('current').each(function(index) {
var section = $(this).attr('href');
if ($(window).scrollTop() >= $(section).offset().top) {
$('#header ul li a').removeClass('current');
$('#header ul li a[href='+section+']').addClass('current');
}
if($(window).scrollTop() + $(window).height() == $(document).height()) {
$('#header ul li a').removeClass('current');
$('#header ul li a:last').addClass('current');
}
});
}