Skip to content

Commit

Permalink
new homepage without force scroll #82
Browse files Browse the repository at this point in the history
I removed the force scroll for the homepage and decided to keep the animation (instead of using of GIF). The animation is looped (it'll restart 3s after it finishes).
The new videos from @VS2000 have been integrated at the exception at the Zenith which is missing.
  • Loading branch information
MathieuNls committed Jan 7, 2016
1 parent b110b43 commit f41ac0d
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 77 deletions.
111 changes: 34 additions & 77 deletions assets/js/home.logic.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
var delta = (Math.random() * 6) + 1 - 2;
var d;

var activeIndex = 0;
var possibleIndex = ["home-video", "demo-screen", "mosa-screen", "publication_footer"];
var animationUnderWay = false;
var timeouts = [];

$( window ).resize(function() {
Expand All @@ -15,94 +12,53 @@ $( window ).resize(function() {

$( document ).ready(function() {


var mousewheelevt = (/Firefox/i.test(navigator.userAgent)) ? "DOMMouseScroll" : "mousewheel" //FF doesn't recognize mousewheel as of FF3.x
var mousewheelevt = (/Firefox/i.test(navigator.userAgent)) ? "DOMMouseScroll" : "mousewheel" //FF doesn't recognize mousewheel as of FF3.x
$(window).bind(mousewheelevt, function(e){

if(!animationUnderWay){
for (var i=0; i<timeouts.length; i++) {
clearTimeout(timeouts[i]);
}

$("#demo-second-step").show();
$("#demo-third-step").hide();
$("#demo-fourth-step").hide();
$("#demo-sync-time").html(5);
$("#inputUserTime").val("");
$("#demo-pointer").removeAttr('style');

animationUnderWay = true;
var evt = window.event || e; //equalize event object
evt = evt.originalEvent ? evt.originalEvent : evt; //convert to originalEvent if possible
var delta = evt.detail ? evt.detail*(-40) : evt.wheelDelta; //check for detail first, because it is used by Opera and FF

if(delta > 0) {
activeIndex = activeIndex -1;
} else {
activeIndex = activeIndex +1;
}

if(activeIndex === -1){
activeIndex = 0;
}else if(activeIndex === 4){
activeIndex = 3;
}

if(activeIndex!==0){
$('header').addClass('blue');
}else{
$('header').removeClass('blue');
}

if(activeIndex === 1){
timeouts.push(setTimeout(countDownDisplay, 1000));
}
var scrollTo = $("#"+possibleIndex[activeIndex]).offset().top - $(".navbar").height();
console.log(scrollTo);
$('html, body').animate({
scrollTop: scrollTo
}, 2000, function() {
animationUnderWay = false;
});
}else{
e.preventDefault();
}

});
if(document.body.scrollTop > $('.home-intro').height()){
$('header').addClass('blue');
}else{
$('header').removeClass('blue');
}

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

initSize();
initCounDown();
initSize();


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

$( "#demo-cta" ).click(function() {
$( "#demo-cta" ).click(function() {

var result = delta;
var result = delta;

$("#demo-pointer").hide();
$("#demo-third-step").hide();
$("#demo-fourth-step").fadeToggle();
$(".watch-accuracy").html(result.toFixed(1));
$("#demo-pointer").hide();
$("#demo-third-step").hide();
$("#demo-fourth-step").fadeToggle();
$(".watch-accuracy").html(result.toFixed(1));
});


});

function initCounDown(){

$("#demo-second-step").show();
$("#demo-third-step").hide();
$("#demo-fourth-step").hide();
$("#demo-sync-time").html(5);
$("#inputUserTime").val("");
$("#demo-pointer").removeAttr('style');
timeouts.push(setTimeout(countDownDisplay, 1000));
}

function initSize(){

var windowHeight = $(window).height();
var windowHeight = $(window).height();

var headerHeight = $('header').height();
var headerHeight = $('header').height();
var sloganHeight = $(".slogan-home");
var windowRealHeight = windowHeight - headerHeight;
//var align = dispoDisplay / 2 - sloganHeight / 2;
Expand Down Expand Up @@ -139,19 +95,17 @@ function similateInput(){
$("#demo-second-step").hide();
$("#demo-third-step").fadeToggle("slow", function (){

var leftDelta = $("#demo-pointer").position().left
var leftDelta = $("#demo-pointer").position().left
- $("#inputUserTime").position().left;

var topDelta = $("#demo-pointer").position().top
var topDelta = $("#demo-pointer").position().top
- $("#inputUserTime").position().top - $("#inputUserTime").height() /2;

$( "#demo-pointer" ).animate({
marginTop: "-="+topDelta,
marginLeft: "-="+leftDelta
}, 2000, function(){

$("#inputUserTime").focus();

var seconds = (d.getSeconds() + Math.floor(Math.abs(delta)));
if(seconds <= 9){
seconds = "0"+seconds;
Expand Down Expand Up @@ -197,4 +151,7 @@ function clickCTA(){
}, 2000, function(){
$("#demo-cta").click();
});
}

timeouts = [];
setTimeout(initCounDown, 10000);
}
Binary file modified assets/videos/Omega.mp4
100644 → 100755
Binary file not shown.
Binary file modified assets/videos/Rolex.mp4
100644 → 100755
Binary file not shown.
Binary file modified assets/videos/Vacheron.mp4
100644 → 100755
Binary file not shown.
Empty file modified assets/videos/Zenith.mp4
100644 → 100755
Empty file.

0 comments on commit f41ac0d

Please sign in to comment.