first wave of corrections done

This commit is contained in:
Bachir Soussi Chiadmi
2015-03-18 16:51:48 +01:00
parent e323a84aec
commit 13fbc8de83
16 changed files with 614 additions and 214 deletions
+70 -37
View File
@@ -51,7 +51,7 @@ jQuery(document).ready(function($) {
launchNav();
// FULL SCREEN
var $fullscreenBtn = $('<div>enter</div>').attr('id','fullscreen-btn').appendTo("#root");
var $fullscreenBtn = $('<div>Plein écran</div>').attr('id','fullscreen-btn').appendTo("#root");
$fullscreenBtn.on('click', onFullScreen);
@@ -250,25 +250,22 @@ jQuery(document).ready(function($) {
_chapters[i].move();
// move header
_$header.css({
transform:"translate3d("+(_nav_pos.x)*0.2+"px, "+(_nav_pos.y)*0.2+"px,0)"
});
// _$header.css({
// transform:"translate3d("+(_nav_pos.x)*0.2+"px, "+(_nav_pos.y)*0.2+"px,0)"
// });
_$header.translate3d({x:_nav_pos.x*0.2,y:_nav_pos.y*0.2});
// bubbles and stars dont move so smoothly on tablette ...
// should keep it only on desktop
// move bubbles
// for (var i = _bubbles.length - 1; i >= 0; i--) {
// _bubbles[i].css({
// transform:"translate3d("+(_nav_pos.x)*0.4+"px, "+(_nav_pos.y)*0.4+"px,0)"
// });
// _bubbles[i].translate3d({x:_nav_pos.x*0.4,y:_nav_pos.y*0.4});
// };
// move stars
// for (var i = _stars.length - 1; i >= 0; i--) {
// _stars[i].css({
// transform:"translate3d("+(_nav_pos.x)*-0.3+"px, "+(_nav_pos.y)*-0.3+"px,0)"
// });
// _stars[i].translate3d({x:_nav_pos.x*-0.3,y:_nav_pos.y*-0.3});
// };
};
@@ -296,7 +293,13 @@ jQuery(document).ready(function($) {
};
function onFullScreen(e){
launchIntoFullscreen(document.getElementById("root"));
if(_$body.is('fullscreen')){
exitFullscreen();
_$body.removeClass('fullscreen');
}else{
launchIntoFullscreen(document.getElementById("root"));
_$body.addClass('fullscreen');
}
if(_loaded_chapter)
setTimeout(_loaded_chapter.buildVideos(), 100);
};
@@ -366,6 +369,15 @@ jQuery(document).ready(function($) {
this.drawLines();
this.setEvents();
this.initDrifiting();
// enable nodes after intro anime
setTimeout(
(function(t){
return function(){
t.$e.addClass('enabled');
}
}(this)),
randB(5000, 8000));
};
Chapter.prototype.setInitPos = function(){
@@ -401,7 +413,7 @@ jQuery(document).ready(function($) {
left:this.pos.x,
top:this.pos.y
});
};// setIniPos()
};
Chapter.prototype.setEvents = function(){
//http://technify.me/user-experience/javascript/jquery/trigger-custom-events-with-jquery/
@@ -449,12 +461,8 @@ jQuery(document).ready(function($) {
? 1
: this.drifting_direction;
this.$title.css({
transform:"translate3d("+this.title_x+"px,0,0)",
});
this.$content.css({
transform:"translate3d("+this.content_x+"px,0,0)",
});
this.$title.translate3d({x:this.title_x});
this.$content.translate3d({x:this.content_x});
}
};
@@ -477,10 +485,7 @@ jQuery(document).ready(function($) {
// if(this.i === 0)
// console.log(this.i+" this.trans.z", this.trans.z);
this.$e.css({
transform:'translate3d('+this.trans.x+'px,'+this.trans.y+'px,0)'
// scale:this.trans.z
});
this.$e.translate3d({x:this.trans.x,y:this.trans.y});
};
Chapter.prototype.preview = function(){
@@ -513,11 +518,8 @@ jQuery(document).ready(function($) {
setTimeout(
(function(i, e, xs, ys){
return function(){
$(e)
.css({
transform:"translate3d("+xs[i]+"px,"+ys[i]+"px,0)",
});
}
$(e).translate3d({x:xs[i],y:ys[i]});
}
}(i, e, that.parts_pos.xs, that.parts_pos.ys)),
10);
@@ -529,18 +531,24 @@ jQuery(document).ready(function($) {
Chapter.prototype.resetPartsPos = function(){
this.parts_pos = {xs:new Array(), ys:new Array()};
for (var i = 0; i < 3; i++) {
for (var i = 0; i < 2; i++) {
switch(i){
case 0:
this.parts_pos.xs.push(randB(-30,30)); this.parts_pos.ys.push(randB(90,110)); break;
this.parts_pos.xs.push(randB(180,280));
this.parts_pos.ys.push(randB(250,350));
break;
case 1:
this.parts_pos.xs.push(randB(180,280)); this.parts_pos.ys.push(randB(250,350)); break;
case 2:
this.parts_pos.xs.push(randB(-280,-180)); this.parts_pos.ys.push(randB(430,530)); break;
this.parts_pos.xs.push(randB(-280,-180));
this.parts_pos.ys.push(randB(430,530));
break;
}
};
this.parts_pos.xs = shuffleArray(this.parts_pos.xs);
this.parts_pos.ys = shuffleArray(this.parts_pos.ys);
// always place the first circle on top center
this.parts_pos.xs.unshift(randB(-30,30));
this.parts_pos.ys.unshift(randB(120,140));
};
Chapter.prototype.closePreview = function(){
@@ -803,8 +811,8 @@ jQuery(document).ready(function($) {
//+ Jonas Raoni Soares Silva
//@ http://jsfromhell.com/array/shuffle [v1.0]
function shuffleArray(o){ //v1.0
for(var j, x, i = o.length; i; j = Math.floor(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
return o;
for(var j, x, i = o.length; i; j = Math.floor(Math.random() * i), x = o[--i], o[i] = o[j], o[j] = x);
return o;
};
if (!Date.now) {
@@ -813,9 +821,9 @@ jQuery(document).ready(function($) {
};
}
function translate3d(x, y, z){
// return
};
// function translate3d(x, y, z){
// // return
// };
/*
_ _ __
@@ -885,6 +893,16 @@ function launchIntoFullscreen(element) {
element.msRequestFullscreen();
}
}
// Whack fullscreen
function exitFullscreen() {
if(document.exitFullscreen) {
document.exitFullscreen();
} else if(document.mozCancelFullScreen) {
document.mozCancelFullScreen();
} else if(document.webkitExitFullscreen) {
document.webkitExitFullscreen();
}
}
/*
@@ -894,6 +912,21 @@ function launchIntoFullscreen(element) {
/ ____/ /___/ /_/ / /_/ // // /| /___/ /
/_/ /_____/\____/\____/___/_/ |_//____/
*/
// translate3d
(function($) {
$.fn.translate3d = function(opt) {
opt = $.extend({x:0,y:0,z:0}, opt);
var t = "translate3d("+opt.x+"px, "+opt.y+"px,"+opt.z+"px)";
this.css({
"-webkit-transform": t,
"-moz-transform": t,
"-ms-transform": t,
"-o-transform": t,
"transform": t
});
};
})(jQuery);
// https://css-tricks.com/snippets/jquery/draggable-without-jquery-ui/
// (function($) {
// $.fn.drags = function(opt) {