Skip to content

Commit

Permalink
Merge pull request #7 from adaptlearning/feature/update-inview
Browse files Browse the repository at this point in the history
Feature/update inview
  • Loading branch information
darylhedley committed May 12, 2014
2 parents cad96ff + 2541e54 commit 9625542
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 9 deletions.
26 changes: 18 additions & 8 deletions js/adapt-contrib-blank.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,28 @@ define(function(require) {

var Blank = ComponentView.extend({

events: {
'inview': 'inview'
},

postRender: function() {
this.setReadyStatus();
this.$('.component-inner').on('inview', _.bind(this.inview, this));
},

inview: function(event, visible) {
if (visible) {
this.setCompletionStatus();
}
inview: function(event, visible, visiblePartX, visiblePartY) {
if (visible) {
if (visiblePartY === 'top') {
this._isVisibleTop = true;
} else if (visiblePartY === 'bottom') {
this._isVisibleBottom = true;
} else {
this._isVisibleTop = true;
this._isVisibleBottom = true;
}

if (this._isVisibleTop && this._isVisibleBottom) {
this.$('.component-inner').off('inview');
this.setCompletionStatus();
}

}
}

});
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"url": "https://github.com/adaptlearning/adapt-contrib-blank/issues"
},
"devDependencies": {
"karma": "~0.9",
"karma": "~0.10",
"karma-mocha": "*",
"karma-expect": "*"
}
Expand Down

0 comments on commit 9625542

Please sign in to comment.