The page is divided for two parts:
- Big 100% browser height header
- Main content and footer
You can see only one of these parts in the browser. I write this code that works fine in Firefox and Chrome:
var $header = $('.mainHeader');
var $main = $('.main');
var $footer = $('.mainFooter')
var $body = $('body');
$('#tosite').on('click', function(e){
$body.css({overflow: 'auto'});
$main.show();
$footer.show();
$([$header, $main, $footer]).each(function(n){
var $this = $(this);
$this.animate({top: -$window.outerHeight()}, 400, 'linear', function(){
if (n == 0) {
$this.hide();
}
$this.css({top:0});
$this.css('position', 'relative');
});
});
e.preventDefault();
return false;
});
$('#back').on('click', function(e){
$body.css({overflow: 'hidden'});
$([$header, $main, $footer]).each(function(n){
var $this = $(this);
$this.css({top: -$window.outerHeight()}).show();
$this.animate({top: 0}, 400, 'linear', function(){
if (n > 0) {
$this.hide();
}
});
});
e.preventDefault();
return false;
});
But in IE there is a big gap after footer for 100% height of the browser. It disappears with every window resize. Looks like a IE bug. Is there a solution?