Pārlūkot izejas kodu

added auto next vid at the end of one

Bachir Soussi Chiadmi 9 gadi atpakaļ
vecāks
revīzija
8106bad409
1 mainītis faili ar 14 papildinājumiem un 4 dzēšanām
  1. 14 4
      sites/all/themes/gui/jee/js/jee.js

+ 14 - 4
sites/all/themes/gui/jee/js/jee.js

@@ -848,7 +848,8 @@ jQuery(document).ready(function($) {
         // add a mask on top of each iframe to avoid bad interaction with vimeo
         this.$vids
           .after('<div class="mask"></div>')
-          .each(this.redimVideo.bind(this));
+          .each(this.redimVideo.bind(this))
+          .each(this.setVidsEvents.bind(this));
 
         var marge = (_container.w-this.dimvideo.w)/4;
         this.$vids_container.css({
@@ -857,6 +858,8 @@ jQuery(document).ready(function($) {
           marginLeft:marge
         });
 
+
+
         // create the slider with peppermint
         this.$slider = $('.field-items', this.$vids_container).Peppermint({
           onSlideChange:this.onSlideChange.bind(this)
@@ -870,9 +873,6 @@ jQuery(document).ready(function($) {
           .css({ width:this.dimvideo.w, height:this.dimvideo.h })
           .attr({ width:this.dimvideo.w, height:this.dimvideo.h });
 
-        // $e.parent()
-        //  .on("click", this.onClickVid.bind(this));
-
         // add some padding to parent for slider display
         $e.parent()
           .css({
@@ -880,6 +880,16 @@ jQuery(document).ready(function($) {
           });
       };
 
+      Chapter.prototype.setVidsEvents = function(i,e){
+        $(e).on("finish", this.onVidFinished.bind(this));
+      };
+
+      Chapter.prototype.onVidFinished = function(){
+        if( this.cur_vid_playing < 2 ){
+          this.$slider.data('Peppermint').next();
+        }
+      };
+
       // not used
       Chapter.prototype.onClickVid = function(e){
         e.stopPropagation();