diff options
| -rw-r--r-- | README.md | 4 | ||||
| -rw-r--r-- | src/nsPopover.js | 13 |
2 files changed, 12 insertions, 5 deletions
@@ -119,6 +119,10 @@ the possible combinations of [position] and [alignment]. * right|bottom - The popover will be positioned on the right side of the triggering element and its bottom will be aligned with the bottom of the triggering element. +### ``ns-popover-hide-on-click {Boolean}`` + +Whether or not to hide the popover when it is clicked on, default: ``true``. + ### Themes diff --git a/src/nsPopover.js b/src/nsPopover.js index b3c9ab5..96a1652 100644 --- a/src/nsPopover.js +++ b/src/nsPopover.js @@ -19,7 +19,8 @@ trigger: attrs.nsPopoverTrigger || 'click',
container: attrs.nsPopoverContainer,
placement: attrs.nsPopoverPlacement || 'bottom|left',
- timeout: attrs.nsPopoverTimeout || 1.5
+ timeout: attrs.nsPopoverTimeout || 1.5,
+ hideOnClick: attrs.nsPopoverHideOnClick === 'true' || attrs.nsPopoverHideOnClick === undefined
};
var hider_ = {
@@ -140,10 +141,12 @@ // |elm|.
move($popover, placement_, align_, getBoundingClientRect(elm[0]), $triangle);
- // Hide the popover without delay on click events.
- $popover.on('click', function() {
- hider_.hide($popover, 0);
- });
+ if (options.hideOnClick) {
+ // Hide the popover without delay on click events.
+ $popover.on('click', function () {
+ hider_.hide($popover, 0);
+ });
+ }
});
elm
|
