File: D:/HostingSpaces/SBogers10/keystud.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);
$('.home .image_holder,.home .side_menu , .news .news_holder,.keystud .bottom_menu li, .contact .bottom_menu li,.horses .years li,.horses .horse_list li, .horses #thumb_list li,.related_horses li').click(function(){ if( ! $(this).hasClass('ignore')) window.location.href = $('a',this).attr('href'); });
/* Hovers */
if( ! isTouch)
{
/*
Header
*/
/*
Home
*/
var speed = 250;
$('.home .image_holder .hover').hover(function()
{
$('.bg',this).stop().animate({ opacity : 1 },speed);
$('.icon',this).stop().animate({ opacity : 1 },speed);
$('.posted',this).stop().animate({ opacity : 1 },speed);
$('.date',this).stop().animate({ opacity : 1 },speed);
},
function()
{
$('.bg',this).stop().animate({ opacity : 0 },speed);
$('.icon',this).stop().animate({ opacity : 0 },speed);
$('.posted',this).stop().animate({ opacity : 0 },speed);
$('.date',this).stop().animate({ opacity : 0 },speed);
});
$('.news .news_holder .hover').hover(function()
{
$('.bg',this).stop().animate({ opacity : 1 },speed);
},
function()
{
$('.bg',this).stop().animate({ opacity : 0 },speed);
});
var $sideMenuListItem = $('.home .side_menu li');
$sideMenuListItem.each(function(){ var color = $(this).css('backgroundColor'); $(this).attr('data-color',color); });
$sideMenuListItem.hover(function()
{
$(this).stop().animate({ backgroundColor : '#00B2A5' },speed);
},function()
{
$(this).stop().animate({ backgroundColor : $(this).attr('data-color') },speed);
});
/*
Keystud
*/
var $submenu = $('.keystud .bottom_menu li,.contact .bottom_menu li');
$submenu.each(function(){ var color = $(this).css('backgroundColor'); $(this).attr('data-color',color); });
$submenu.hover(function()
{
$(this).stop().animate({ backgroundColor : '#FFCA00' },speed);
},function()
{
$(this).stop().animate({ backgroundColor : $(this).attr('data-color') },speed);
});
/*
Horses
*/
// Mouse over Aside list -> Light up horse in thumbnails
var speed1 = 200;
$a = $('.horses .horse_list li');
$bHorses = $('.b li');
$a.hover(function(){ var index = $(this).index(); $bHorses.not(':eq(' + index + '),.cta,.streamer').stop().animate({ opacity: 0.3 },speed1) },function() { var index = $(this).index(); $bHorses.not(':eq(' + index + ')').stop().animate({ opacity: 1 },speed1) } );
// Hover background color Aside list
var speed2 = 100;
var $horseList = $('.aside .years li,.aside .horse_list li');
$horseList.each(function(){ var color = $(this).css('backgroundColor'); $(this).attr('data-color',color); });
$horseList.hover(function()
{
if( ! $(this).hasClass('ignore'))
{
$(this).stop().animate({ backgroundColor : '#FFAA00' },speed2);
}
},function()
{ if( ! $(this).hasClass('ignore'))
{
$(this).stop().animate({ backgroundColor : $(this).attr('data-color') },speed2);
}
});
// Mouse over Thumbs -> Light up aside list
var speed4 = 200;
$bHorses.hover(function()
{
var index = $(this).attr('data-eq');
$('.horses .horse_list li').eq(index).stop().animate({ backgroundColor : '#009B93' },speed4);
},
function()
{
var index = $(this).attr('data-eq');
$('.horses .horse_list li').eq(index).stop().animate({ backgroundColor : $('.horses .horse_list li').eq(index).attr('data-color') },speed4);
}
);
// Hover thumbs
var speed3 = 400;
var $horseThumbs = $('#thumb_list li');
$horseThumbs.hover(function()
{
$('.hover_bg',this).stop().animate({ opacity: 0.8, height: '100%' },speed3);
$('.hover_text',this).stop().animate({ top:0 },speed3);
},function()
{
$('.hover_bg',this).stop().animate({ opacity: 0, height: 0 },speed3);
$('.hover_text',this).stop().animate({ top: '100%' },speed3);
});
}
// Back to top aside
$(document).ready(function()
{
/*
Hover "fade" buttons
*/
var $fade = $('.fade');
// First set data-color
$fade.each(function(){
if(typeof $(this).attr('data-bgColor') == 'undefined')
{
$(this).attr('data-bgColor',$(this).css('backgroundColor'));
$(this).attr('data-color',$(this).css('color'));
}
});
// Set Hover
$fade.hover(
function()
{
if( ! $(this).hasClass('active'))
{
var color, bgColor;
// determine hover color
switch($(this).attr('data-bgColor'))
{
case 'rgb(255, 160, 0)':
bgColor = '#FF8800';
color = '#ffffff';
break;
default:
bgColor = '#FFA000';
color = '#ffffff';
}
$(this).stop().animate({ color: color, backgroundColor: bgColor },200)
}
},
function()
{
if( ! $(this).hasClass('active'))
{
$(this).stop().animate({ color: $(this).attr('data-color'), backgroundColor: $(this).attr('data-bgColor') },200)
}
}
);
// Objects
var $div = $('.back_to_top');
var $list = $('.aside .horse_list');
// Toggle point
var asideHeight = $('.aside .years').height();
if ($list.height() > asideHeight){ asideHeight = $list.height(); }
// Set div
var st = $(this).scrollTop();
var hidden = 1;
if(st > asideHeight){ hidden = 0; $div.css({ display : 'block', opacity : 1}); }
// Click -> go back to top;
$div.click(function(){ $('html,body').stop().animate({ scrollTop: 0 },800); });
// Window scroll
$(window).scroll(function()
{
var st = $(this).scrollTop();
if(st > asideHeight)
{
if(hidden)
{
hidden = 0;
$div.css('display','block');
$div.stop().animate({ opacity : 1 },200);
}
}
else
{
if( ! hidden)
{
hidden = 1;
$div.stop().animate({ opacity : 0 },200,function(){
$div.css('display','none');
});
}
}
});
});