File: D:/HostingSpaces/SBogers87/basephotography.nl/wwwroot/js/home.js
/**
* Created by Pascal on 27/05/16.
*/
$(function () {
resizer();
$(window).resize(function () {
resizer();
});
$(window).scroll(function () {
scroller();
});
$('.blocks-before .block1, .blocks-before .block2, .blocks-before .block3').click(function () {
var scrollOffset = 500;
if($('body').width() <= 860) scrollOffset = 700;
console.log(scrollOffset);
$('html,body').animate({
scrollTop: $('.project-row').offset().top + scrollOffset
}, 800);
});
$('.project-sub .block1, .project-sub .block2, .project-sub .block3').click(function () {
$('html,body').animate({
scrollTop: $('#showreel').offset().top - 120
}, 800);
});
$('.showreel-sub .block1, .showreel-sub .block2, .showreel-sub .block3').click(function () {
$('html,body').animate({
scrollTop: $('.about').offset().top - 120
}, 800);
});
$('.blocks-after .block1, .blocks-after .block2').click(function () {
$('html,body').animate({
scrollTop: $('#contact').offset().top - 120
}, 800);
});
});
function resizer() {
reCalculate();
drawLines();
}
function scroller() {
reCalculate();
$scrolled = $(document).scrollTop();
if(isElementFullInViewport($('.more-projects'))){
$('.more-projects').addClass('animate');
}
if($scrolled < 300){
$('.main').removeClass('show');
}
if(!isElementFullInViewport($('.header-image-row')) && $scrolled > 300){
$('.main').addClass('show');
}
$('.blocks-before .block1').css('top', (($scrolled * 0.14) - 100));
$('.blocks-before .block2').css('top', (($scrolled * 0.10) + 250));
$('.blocks-before .block3').css('top', (($scrolled * 0.07) + 500));
$('.blocks-after .block1').css('top', (($scrolled * 0.07)) - 100);
$('.blocks-after .block2').css('top', (($scrolled * 0.05) - 200));
$('.project-row .project-header').css('margin-top', (($scrolled * 0.15) + 450));
$('.project-sub .block1').css('top', (($scrolled * 0.24) - 800));
$('.project-sub .block2').css('top', (($scrolled * 0.16) - 200));
$('.project-sub .block3').css('top', (($scrolled * 0.1) + 250));
$('.showreel-sub .block1').css('top', (($scrolled * 0.08) - 300));
$('.showreel-sub .block2').css('top', (($scrolled * 0.12) - 300));
$('.showreel-sub .block3').css('top', (($scrolled * 0.17) - 350));
}
function reCalculate(){
var headerHeight = ($(window).width() / 16 * 9);
if(headerHeight > $(window).height()){
headerHeight = $(window).height();
}
$('.header-image-row').height(headerHeight);
$('.showreel-row .video iframe').width($('.showreel-row .video').width());
$('.showreel-row .video iframe').height(($('.showreel-row .video').width()/16*9));
//calculate right of ProjectText
$('.project-row .project-header').css('right' , (((($(window).width() - $('.project-row .project-container').width()) / 2) - 132) + 'px') );
$('.project-row .project-header').css('top' , ($('.project-row .project-header').width()+'px'));
//make projects home more like squares
$('.project-container .project').each(function(){
$(this).find('>a').css( 'min-height', (($(this).width() /18 * 5)+'px'));
});
}