File: D:/HostingSpaces/SBogers10/keystud.komma-mediadesign.nl/wwwroot/public/js/responsive_horses.js
// Elements
var $header = $('#header');
var $footer = $('#footer');
var $content = $('#content');
var $years = $('.years');
var $list = $('.horse_list');
var $tList = $('#thumb_list');
var $a = $('.a');
var $b = $('.b');
// Init dashboard flexgrid
$tList.flexgrid();
checkViews(); // first resize
//setTimeout(checkViews,500); // fallback for if fonts load slowly
if (browserName == 'IE' && majorVersion <= 8) {
document.body.onresize = function () {
checkViews();
};
}
else {
$(window).wresize(checkViews);
}
function checkViews()
{
// Size variables
//var wSize = { w : window.innerWidth || document.documentElement.clientWidth, h : window.innerHeight || document.documentElement.clientHeight };
var wSize = { w : $('body').width(), h : window.innerHeight || document.documentElement.clientHeight };
var view = parseInt($('#view').width());
switch(view)
{
// View 1
case 1:
case 2:
// $a-width + $b-width = windowWidth
var newWidth = Math.floor(wSize.w - $a.width());
$b.width(newWidth);
$content.width(wSize.w);
// Reset Height
$('.a,.b').height('auto');
// Start with matching it with window size
var newHeight = wSize.h - $header.outerHeight() - $footer.outerHeight();
// If the $a container is taller, match it with the $a size
if($a.height() > newHeight) newHeight = $a.height();
// Set height
$('.b,#thumb_list').height(newHeight);
$('.a').height(newHeight + $footer.outerHeight());
// Resize flexgrid
$tList.data('flexgrid').resize();
// Do we need to adjust the heigt of $a,$b and $content?
if($tList.height() > $a.height()) $('.a,.b').height($tList.height());
break;
// View 3
case 3:
break;
}
var h = $years.height();
if($list.height() > h) h = $list.height();
if($b.height() > h) h = $b.height();
console.log(h);
if(h > (wSize.h - $header.outerHeight() - $footer.outerHeight()))
{
$content.height(h);
}
else
{
var newH = wSize.h - $header.outerHeight();
$content.height(newH);
}
// Always
resizeImages();
}