Skip to content

Commit

Permalink
fix resize issues Refs #32
Browse files Browse the repository at this point in the history
  • Loading branch information
MathieuNls committed Jun 15, 2015
1 parent a6b4589 commit 366095d
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 15 deletions.
42 changes: 27 additions & 15 deletions application/views/home.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,27 +124,18 @@
var delta = Math.floor((Math.random() * 10) + 1) - 5;
var d;

$( window ).resize(function() {
initSize();
});

$( document ).ready(function() {

$("#demo-third-step").hide();
$("#demo-fourth-step").hide();

var windowHeight = $(window).height();
var headerHeight = $('header').height();
var sloganHeight = $(".slogan-home");
var windowRealHeight = windowHeight - headerHeight;
//var align = dispoDisplay / 2 - sloganHeight / 2;

$(".slogan-home").css("margin-top", -windowRealHeight + windowRealHeight/2);

var ratio = $("#mosa-picture-1").width() / 800 ;

$(".home-mosa").css("height", 450*ratio*2);

$(".home-mosa-stats").css("left", $(window).width()/2-$(".home-mosa-stats").width()/2 - 20);
$(".home-mosa-stats").css("marginTop", (450*ratio*2)/2 - $(".home-mosa-stats").height()/2 - 20);
initSize();


$('video,audio').mediaelementplayer({features: []});

$(".continue").click(function(){
Expand All @@ -162,10 +153,31 @@
$(".watch-accuracy").html(result.toFixed(0));
});


});

function initSize(){

var windowHeight = $(window).height();
var headerHeight = $('header').height();
var sloganHeight = $(".slogan-home");
var windowRealHeight = windowHeight - headerHeight;
//var align = dispoDisplay / 2 - sloganHeight / 2;

$(".slogan-home").css("margin-top", -windowRealHeight + windowRealHeight/2);

var ratio = $("#mosa-picture-1").width() / 800 ;

$(".home-mosa").css("height", 450*ratio*2);

$(".home-mosa-stats").css("left", $(window).width()/2-$(".home-mosa-stats").width()/2 - 20);
$(".home-mosa-stats").css("marginTop", (450*ratio*2)/2 - $(".home-mosa-stats").height()/2 - 20);

$( ".slogan-home" ).animate({
marginTop: "-=300"
}, 2000);
});

}

function countDownDisplay(){
var countdown = $("#demo-sync-time").html();
Expand Down
1 change: 1 addition & 0 deletions assets/js/application.js
Original file line number Diff line number Diff line change
Expand Up @@ -532,6 +532,7 @@ function resizeContent()

$('.content').css('min-height', (windowHeight-(headerHeight-30)-footerHeight)+'px');
$('.content').css('min-height', (windowHeight-(headerHeight-30)-footerHeight)+'px');
$('.content').css('margin-top', (headerHeight+50)+'px');
$('.home-intro, .home-intro-overlay').css('min-height', windowHeight+'px');
}

Expand Down

0 comments on commit 366095d

Please sign in to comment.