click on vignette to open chapter
This commit is contained in:
@@ -392,13 +392,12 @@ jQuery(document).ready(function($) {
|
||||
this.ease = randB(0.05, 0.2);
|
||||
|
||||
//drifting
|
||||
this.$title = $('h2.node-title', this.$e);
|
||||
this.$content = $('.content:first', this.$e);
|
||||
this.title_x = 0;
|
||||
this.content_x = 0;
|
||||
this.drifting_direction = Math.random()-0.5 > 0 ? 1 : -1;
|
||||
this.drifting_time = null;
|
||||
|
||||
// this.$title = $('h2.node-title', this.$e);
|
||||
// this.$content = $('.content:first', this.$e);
|
||||
// this.title_x = 0;
|
||||
// this.content_x = 0;
|
||||
// this.drifting_direction = Math.random()-0.5 > 0 ? 1 : -1;
|
||||
// this.drifting_time = null;
|
||||
|
||||
//preview
|
||||
this.is_previewed = false;
|
||||
@@ -497,44 +496,47 @@ jQuery(document).ready(function($) {
|
||||
// return false;
|
||||
// });
|
||||
|
||||
$('.links a', this.$e)
|
||||
$('.links a, .field-name-field-vignette img', this.$e)
|
||||
.on('click', this, function(e){
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
e.data.loadNode();
|
||||
return false;
|
||||
if(e.data.is_previewed){
|
||||
console.log('click, is previewed');
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
e.data.loadNode();
|
||||
return false;
|
||||
}
|
||||
});
|
||||
};
|
||||
|
||||
Chapter.prototype.initDrifiting = function(){
|
||||
// an other option could be to drift the whole page with the same engine than draging
|
||||
requestAnimationFrame(this.drift.bind(this));
|
||||
};
|
||||
// Chapter.prototype.initDrifiting = function(){
|
||||
// // an other option could be to drift the whole page with the same engine than draging
|
||||
// requestAnimationFrame(this.drift.bind(this));
|
||||
// };
|
||||
|
||||
Chapter.prototype.drift = function(timestamp){
|
||||
requestAnimationFrame(this.drift.bind(this));
|
||||
// Chapter.prototype.drift = function(timestamp){
|
||||
// requestAnimationFrame(this.drift.bind(this));
|
||||
|
||||
var now = new Date().getTime(),
|
||||
dt = now - (this.drifting_time || now);
|
||||
// var now = new Date().getTime(),
|
||||
// dt = now - (this.drifting_time || now);
|
||||
|
||||
this.drifting_time = now;
|
||||
// this.drifting_time = now;
|
||||
|
||||
if(!this.is_previewed){
|
||||
// if(!this.is_previewed){
|
||||
|
||||
this.title_x += (10/1000)*dt*this.drifting_direction;
|
||||
this.content_x += (6/1000)*dt*this.drifting_direction;
|
||||
// this.title_x += (10/1000)*dt*this.drifting_direction;
|
||||
// this.content_x += (6/1000)*dt*this.drifting_direction;
|
||||
|
||||
this.drifting_direction =
|
||||
this.content_x > randB(100,130)
|
||||
? -1
|
||||
: this.content_x < -randB(100,130)
|
||||
? 1
|
||||
: this.drifting_direction;
|
||||
// this.drifting_direction =
|
||||
// this.content_x > randB(100,130)
|
||||
// ? -1
|
||||
// : this.content_x < -randB(100,130)
|
||||
// ? 1
|
||||
// : this.drifting_direction;
|
||||
|
||||
this.$title.translate3d({x:this.title_x});
|
||||
this.$content.translate3d({x:this.content_x});
|
||||
}
|
||||
};
|
||||
// this.$title.translate3d({x:this.title_x});
|
||||
// this.$content.translate3d({x:this.content_x});
|
||||
// }
|
||||
// };
|
||||
|
||||
Chapter.prototype.move = function(){
|
||||
if(this.is_previewed)
|
||||
@@ -732,7 +734,7 @@ jQuery(document).ready(function($) {
|
||||
// |_____|__| |_____|_|___| |_____|__|__|__|__|__| |_| |_____|__|__|
|
||||
|
||||
Chapter.prototype.loadNode = function(e){
|
||||
// console.log("Chapter :: open : nid", this.nid);
|
||||
console.log("Chapter :: open : nid", this.nid);
|
||||
_$body.addClass('loading');
|
||||
|
||||
$.getJSON(
|
||||
|
||||
Reference in New Issue
Block a user