Skip to content

Commit

Permalink
resizing window not only on load
Browse files Browse the repository at this point in the history
  • Loading branch information
tholman committed Sep 2, 2014
1 parent 93805bd commit 1ee083b
Showing 1 changed file with 26 additions and 15 deletions.
41 changes: 26 additions & 15 deletions js/meet-the-ipsums.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,19 +19,7 @@ var carouselElements = document.querySelectorAll( 'article' );
var currentSlide = 0;
var animationTime = 750;

/*
* Sizes
*/

headerContainer.className = "heading translatable";
var height = window.innerHeight;

headerContainer.style.width = window.innerWidth - 160 + "px";

footer.style.paddingTop = ((height / 2) - 90) + "px";
footer.style.height = height + "px";

list.style.marginBottom = height + "px";


/*
Expand All @@ -40,7 +28,7 @@ list.style.marginBottom = height + "px";

var active = false;
var lastElement, nextElement;
window.addEventListener( 'scroll', onScroll, false)
window.addEventListener( 'scroll', onScroll, false );

function onScroll( event ) {

Expand All @@ -57,6 +45,31 @@ function onScroll( event ) {
}
}

/*
* Sizes
*/

window.addEventListener( 'resize', onResize, false );

function onResize( event ) {
var height = window.innerHeight;

headerContainer.style.width = window.innerWidth - 160 + "px";

footer.style.paddingTop = ((height / 2) - 90) + "px";
footer.style.height = height + "px";

list.style.marginBottom = height + "px";

console.log( "hello?" );
}

onResize();

/*
* Carousel
*/

function updateCarousel() {

lastElement = currentSlide;
Expand All @@ -82,8 +95,6 @@ function updateCarousel() {
setTimeout( function() {
execute();
}, animationTime);


}

setInterval( updateCarousel, 6000 );

0 comments on commit 1ee083b

Please sign in to comment.