File: D:/HostingSpaces/SBogers10/pvg.komma-mediadesign.nl/wwwroot/public/js/main.js
var isTouch = ( (navigator.platform.indexOf("iPhone") != -1) || (navigator.platform.indexOf("iPod") != -1) || (navigator.platform.indexOf("iPad") != -1) );
var isIE = navigator.userAgent.match(/MSIE/i) != null;
var version = parseInt(navigator.appVersion,10);
// SVG Fix
if(isIE && version <= 8 ) {
$('img[src*="svg"]').attr('src', function() {
return $(this).attr('src').replace('.svg', '.png');
});
}
// If no welcome holder, create an elevator
// Else create one in welcome.js
if( ! $('#welcome_holder').length > 0)
{
var elevator = new Elevator();
elevator.init();
elevator.slide();
}
// Navigation little arrow
$('#nav .active .arrow').stop().animate({bottom: -.357142857+'em'},300);
// Animate komma logo in footer
$('#komma_link').hover(
function(){
$(this).stop().animate({ opacity: 1 },200);
},
function()
{
$(this).stop().animate({ opacity: 0.5 },200);
}
);
// Sticky footer
$footer = $('#footer');
var fH = $footer.height() + parseInt($footer.css('paddingTop'));
var bH = $('body').height() - fH;
stickyFooter();
$(window).resize(stickyFooter);
function stickyFooter()
{
var wH = window.innerHeight || document.body.clientHeight;
if( $footer.offset().top <= (wH - fH) && bH + fH < wH )
{
$footer.css({position: 'fixed', left: 0, bottom: 0});
}
else
{
$footer.css({position: 'relative', left: 0, bottom: 0});
}
}
// Hovers
if( ! isTouch)
{
var speed = 150;
var blue = '#004B6A'
var lightBlue = '#A1BACB'
var darkBlue = '#003242'
var red = '#E87B70'
// set all color data
$('a').each(function()
{
$(this).attr('data-returnColor',$(this).css('color'));
})
// Hover main navigation
$('#nav li').hover(function()
{
if( ! $(this).hasClass('active'))
{
$('a',this).stop().animate({ color: lightBlue},speed);
$('.hover',this).stop().animate({ bottom: 0+'px', opacity: 1 },speed);
}
},
function()
{
if( ! $(this).hasClass('active'))
{
$('a',this).stop().animate({ color: blue},speed);
$('.hover',this).stop().animate({ bottom: -3+'px', opacity: 0},speed);
}
});
speed = 50;
// Anchors in paragraphs
var prevColor = blue;
$('p a, #sitemap a, .text a').hover(function()
{
prevColor = $(this).attr('data-returnColor');
$(this).stop().animate({ color: red},speed);
},
function()
{
$(this).stop().animate({ color: prevColor},speed);
});
// Links in footer && submenu
prevColor = blue;
$('#footer a, .submenu a').hover(function()
{
if ($(this).attr('id') != 'komma_link')
{
prevColor = $(this).attr('data-returnColor');
$(this).stop().animate({ color: blue},speed);
}
},
function()
{
if ($(this).attr('id') != 'komma_link')
{
$(this).stop().animate({ color: prevColor},speed);
}
});
// Hover on "Call to action messages"
speed = 300;
var $ctaListItem = $('#thumb_nav li');
$ctaListItem.hover(function()
{
$(this).stop().animate({ opacity: 1 },speed);
$('.arrow_white',this).stop().animate({ left: 0, opacity: 1 },speed);
$('.arrow_blue',this).stop().animate({ left: '4em', opacity: 0 },speed);
$('.bg_blue',this).stop().animate({ width: '4em' },speed);
$('.btn',this).stop().animate({ backgroundColor: '#E87B70' },speed);
},
function()
{
$(this).stop().animate({ opacity: 0.4 },speed);
$('.arrow_white',this).stop().animate({ left: '-4em', opacity: 0 },speed);
$('.arrow_blue',this).stop().animate({ left: 0, opacity: 1 },speed);
$('.bg_blue',this).stop().animate({ width: 0 },speed);
$('.btn',this).stop().animate({ backgroundColor: '#A1B9C9' },speed);
});
$ctaListItem.click(function()
{
window.location.href = $('a.title',this).attr('href');
});
// Aside clouds
$('a','.floors').hover(function()
{
$(this).siblings('.cloud').stop().animate({ opacity: 1, left: '2.5em'},speed);
},
function()
{
$(this).siblings('.cloud').stop().animate({ opacity: 0, left: '3em'},speed);
});
}