diff --git a/README.md b/README.md index 91665cd..10a6b2a 100644 --- a/README.md +++ b/README.md @@ -67,7 +67,7 @@ The Background selector attribute group contains values for **_isEnabled**, **_h No known limitations. ---------------------------- -**Version number:** 3.0.0 +**Version number:** 3.0.1 **Framework versions supported:** 5+ **Author / maintainer:** DeltaNet with [contributors](https://github.com/deltanet/adapt-background-selector/graphs/contributors) **Accessibility support:** Yes diff --git a/bower.json b/bower.json index f9ca314..389ba66 100644 --- a/bower.json +++ b/bower.json @@ -1,6 +1,6 @@ { "name": "adapt-background-selector", - "version": "3.0.0", + "version": "3.0.1", "framework": ">=5", "homepage": "https://github.com/deltanet/adapt-background-selector", "issues": "https://github.com/deltanet/adapt-background-selector/issues", diff --git a/js/background-selector-videoView.js b/js/background-selector-videoView.js index 26cc361..2419bfb 100644 --- a/js/background-selector-videoView.js +++ b/js/background-selector-videoView.js @@ -13,7 +13,6 @@ define([ 'remove': this.remove, 'popup:opened': this.popupOpened, 'popup:closed': this.popupClosed, - 'pageView:ready': this.pageReady, 'device:changed': this.deviceChanged }); }, @@ -39,6 +38,8 @@ define([ this.audioPromptIsOpen = false; this.videoIsInView = false; + $(this.modelID).on('onscreen', this.onscreen.bind(this)); + this.deviceChanged(); _.delay(function() { @@ -46,10 +47,6 @@ define([ }.bind(this), 500); }, - pageReady: function () { - $(this.modelID).on('onscreen', this.onscreen.bind(this)); - }, - popupOpened: function() { if ($('body').children('.audio-prompt').css('visibility') == 'visible') { this.playVideo(false); @@ -95,7 +92,8 @@ define([ onscreen: function(event, measurements) { var visible = this.model.get('_isVisible'); var isOnscreenX = measurements.percentInviewHorizontal == 100; - var isOnscreenY = measurements.percentFromTop > 30 && measurements.percentFromTop < 101; + var isOnscreenY = (measurements.percentFromTop < 50) && (measurements.percentFromTop > -10); + if (visible && isOnscreenX && isOnscreenY) { if (!this.notifyIsOpen && !this.audioPromptIsOpen) {