cms/app-client/app/components/transcript-component.js
changeset 255 ed05b89e3299
parent 249 e4204b1a579a
child 257 eba9edbd8f46
equal deleted inserted replaced
254:a7cf2887e993 255:ed05b89e3299
    14         this.set('autoscroll', true);
    14         this.set('autoscroll', true);
    15     }),
    15     }),
    16 
    16 
    17     didUpdate: function() {
    17     didUpdate: function() {
    18         var self = this;
    18         var self = this;
    19         if(this.get('autoscroll')) {
    19         var target = Ember.$('.sentence.active');
       
    20         if(this.get('autoscroll') && target.length) {
    20             Ember.$(this.get('autoscrollElement')).animate({
    21             Ember.$(this.get('autoscrollElement')).animate({
    21                 scrollTop: Ember.$('.sentence.active').offset().top + Ember.$(this.get('autoscrollElement')).scrollTop() - Ember.$(this.get('autoscrollElement')).offset().top - 154
    22                 scrollTop: target.offset().top + Ember.$(this.get('autoscrollElement')).scrollTop() - Ember.$(this.get('autoscrollElement')).offset().top - 154
    22             }, 150);
    23             }, 150);
    23         }
    24         }
    24     },
    25     },
    25 
    26 
    26     actions: {
    27     actions: {