Browse Source

Break out close events into separate methods

pull/5282/head
Jack Lukic 7 years ago
parent
commit
775df0e061
2 changed files with 28 additions and 18 deletions
  1. 2
      RELEASE-NOTES.md
  2. 44
      src/definitions/modules/popup.js

2
RELEASE-NOTES.md

@ -4,9 +4,9 @@
**Enhancements** **Enhancements**
- **Modal** - Adds `tiny` and `mini` sized modals #5123 **Thanks @Banandrew** - **Modal** - Adds `tiny` and `mini` sized modals #5123 **Thanks @Banandrew**
- **Popup* - Added `bind clickaway` `bind touchclose` `bind close on scroll` behaviors to make it easier for `on: 'manual'` popup to specify behavior
**Bugs** **Bugs**
- **Sidebar** - Removed use of `ios` browser detection, and use of `-webkit-overflow-scrolling: touch;`. iOS no longer has sizing issues when displaying sidebar content in latest iOS. - **Sidebar** - Removed use of `ios` browser detection, and use of `-webkit-overflow-scrolling: touch;`. iOS no longer has sizing issues when displaying sidebar content in latest iOS.
- **Search** - Fixed issue where `searchDelay` could cause results to appear after search had lost focus. - **Search** - Fixed issue where `searchDelay` could cause results to appear after search had lost focus.
- **Sticky** - Fix issue where sticky would cause page to shift when `context` height was determined by sticky's height in `position: static;` #3430 - **Sticky** - Fix issue where sticky would cause page to shift when `context` height was determined by sticky's height in `position: static;` #3430

44
src/definitions/modules/popup.js

@ -986,28 +986,38 @@ $.fn.popup = function(parameters) {
}, },
close: function() { close: function() {
if(settings.hideOnScroll === true || (settings.hideOnScroll == 'auto' && settings.on != 'click')) { if(settings.hideOnScroll === true || (settings.hideOnScroll == 'auto' && settings.on != 'click')) {
$scrollContext
.one(module.get.scrollEvent() + elementNamespace, module.event.hideGracefully)
;
tpl.bind.closeOnScroll();
} }
if(settings.on == 'hover' && openedWithTouch) { if(settings.on == 'hover' && openedWithTouch) {
module.verbose('Binding popup close event to document');
$document
.on('touchstart' + elementNamespace, function(event) {
module.verbose('Touched away from popup');
module.event.hideGracefully.call(element, event);
})
;
tpl.bind.touchClose();
} }
if(settings.on == 'click' && settings.closable) { if(settings.on == 'click' && settings.closable) {
module.verbose('Binding popup close event to document');
$document
.on('click' + elementNamespace, function(event) {
module.verbose('Clicked away from popup');
module.event.hideGracefully.call(element, event);
})
;
tpl.bind.clickaway();
} }
},
closeOnScroll: function() {
module.verbose('Binding scroll close event to document');
$scrollContext
.one(module.get.scrollEvent() + elementNamespace, module.event.hideGracefully)
;
},
touchClose: function() {
module.verbose('Binding popup touchclose event to document');
$document
.on('touchstart' + elementNamespace, function(event) {
module.verbose('Touched away from popup');
module.event.hideGracefully.call(element, event);
})
;
},
clickaway: function() {
module.verbose('Binding popup close event to document');
$document
.on('click' + elementNamespace, function(event) {
module.verbose('Clicked away from popup');
module.event.hideGracefully.call(element, event);
})
;
} }
}, },

Loading…
Cancel
Save