bug fix
This commit is contained in:
@@ -115,14 +115,18 @@ jQuery(document).ready(function($) {
|
||||
|
||||
function initChapterWrapper(){
|
||||
$('<div id="home-btn">')
|
||||
.on("click", closeChapterWrapper)
|
||||
.on("click", onCloseChapterWrapper)
|
||||
.appendTo(_$chapter_wrapper);
|
||||
};
|
||||
|
||||
function closeChapterWrapper(e){
|
||||
function onCloseChapterWrapper(e){
|
||||
_loaded_chapter.stopAndClose();
|
||||
_loaded_chapter = false;
|
||||
_$chapter_wrapper.removeClass('visible');
|
||||
_$body.removeClass('chapter-displayed');
|
||||
setTimeout(function(){
|
||||
_$chapter_wrapper.find('.node').remove();
|
||||
}, 2000);
|
||||
};
|
||||
|
||||
function initChapters(){
|
||||
@@ -312,6 +316,13 @@ jQuery(document).ready(function($) {
|
||||
setTimeout(_loaded_chapter.buildVideos(), 100);
|
||||
};
|
||||
|
||||
/*
|
||||
_____ _____ _____ _____ _____ _____ _____
|
||||
| __|_ _| _ |_ _| | | __|
|
||||
|__ | | | | | | | |- -| --|__ |
|
||||
|_____| |_| |__|__| |_| |_____|_____|_____|
|
||||
|
||||
*/
|
||||
function initStaticLinks(){
|
||||
$('ul.menu a', _$footer).on('click', onClickStaticLink);
|
||||
_$close_static.on('click', onCloseStatic);
|
||||
@@ -735,7 +746,7 @@ jQuery(document).ready(function($) {
|
||||
|
||||
// record some usefull data
|
||||
this.$n = $('.node-chapitre', _$chapter_wrapper);
|
||||
this.$blocks = $('.field-type-text-long', this.$n);
|
||||
this.$blocks = $('.field-type-text-long, .field-type-text', this.$n);
|
||||
this.$vids_container = $('.field-name-field-partie', this.$n);
|
||||
this.$vids = $('iframe', this.$vids_container);
|
||||
// record the current loaded chapter
|
||||
@@ -750,7 +761,7 @@ jQuery(document).ready(function($) {
|
||||
console.log('Chapter :: displayNode '+this.nid);
|
||||
|
||||
// place text blocks
|
||||
this.texts_pos = shuffleArray([1,2,3]);
|
||||
this.texts_pos = shuffleArray([1,2,3,4]);
|
||||
this.$blocks
|
||||
.each(this.placeText.bind(this))
|
||||
.pep({
|
||||
@@ -773,7 +784,17 @@ jQuery(document).ready(function($) {
|
||||
Chapter.prototype.placeText = function(i, e){
|
||||
// console.log("Chapter :: placeText", e);
|
||||
switch(this.texts_pos[i]){
|
||||
case 1: // top right
|
||||
case 1: // top left
|
||||
$(e)
|
||||
.css({
|
||||
top:randB(_container.h*0.05-$(e).height(),_container.h*0.15-$(e).height()),
|
||||
left:randB(_container.w*0.1,_container.w*0.2)
|
||||
})
|
||||
// .pep({debug:true, startPos:{bottom:randB(80,90),right:randB(80,90)}})
|
||||
.find('.field-label')
|
||||
.appendTo(e);
|
||||
break;
|
||||
case 2: // top right
|
||||
$(e)
|
||||
.css({
|
||||
top:randB(_container.h*0.05-$(e).height(),_container.h*0.15-$(e).height()),
|
||||
@@ -783,14 +804,14 @@ jQuery(document).ready(function($) {
|
||||
.find('.field-label')
|
||||
.appendTo(e);
|
||||
break;
|
||||
case 2: // bottom left
|
||||
case 3: // bottom left
|
||||
$(e).css({
|
||||
top:randB(_container.h*0.8,_container.h*0.9),
|
||||
left:randB(_container.w*0.1,_container.w*0.2)
|
||||
});
|
||||
// $(e).pep({debug:true, startPos:{top:randB(80,90),left:randB(10,30)}});
|
||||
break;
|
||||
case 3: // bottom right
|
||||
case 4: // bottom right
|
||||
$(e).css({
|
||||
top:randB(_container.h*0.8,_container.h*0.9),
|
||||
left:randB(_container.w*0.7,_container.w*0.9-$(e).width())
|
||||
@@ -836,9 +857,10 @@ jQuery(document).ready(function($) {
|
||||
paddingLeft:this.dimvideo.w*0.15,
|
||||
paddingright:this.dimvideo.w*0.15
|
||||
})
|
||||
.on("click", this.onClickVid.bind(this));
|
||||
// .on("click", this.onClickVid.bind(this));
|
||||
};
|
||||
|
||||
// not used
|
||||
Chapter.prototype.onClickVid = function(e){
|
||||
e.stopPropagation();
|
||||
e.preventDefault();
|
||||
@@ -847,22 +869,18 @@ jQuery(document).ready(function($) {
|
||||
var $vid = $('iframe', e.currentTarget);
|
||||
|
||||
$vid.vimeo('paused', function(data){
|
||||
|
||||
console.log('paused : ', data);
|
||||
|
||||
console.log('paused : ', data)
|
||||
if(data){
|
||||
$vid.vimeo('play');
|
||||
}else{
|
||||
$vid.vimeo('pause');
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
return false;
|
||||
};
|
||||
|
||||
Chapter.prototype.onSlideChange = function(){
|
||||
console.log('onSlideChange '+this.nid, this.$slider.data('Peppermint').getCurrentPos());
|
||||
console.log('onSlideChange nid :'+this.nid+'| current : ', this.$slider.data('Peppermint').getCurrentPos());
|
||||
|
||||
//stop current video playing
|
||||
this.$vids.eq(this.cur_vid_playing).vimeo('pause');
|
||||
@@ -872,6 +890,11 @@ jQuery(document).ready(function($) {
|
||||
this.$vids.eq(this.cur_vid_playing).vimeo('play');
|
||||
};
|
||||
|
||||
Chapter.prototype.stopAndClose = function(){
|
||||
console.log('stopAndClose nid :'+this.nid+'| current : '+this.cur_vid_playing);
|
||||
this.$vids.eq(this.cur_vid_playing).vimeo('unload');
|
||||
};
|
||||
|
||||
Node.initialized = true;
|
||||
};
|
||||
|
||||
|
||||
Reference in New Issue
Block a user