aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--README.md4
-rw-r--r--src/nsPopover.js13
2 files changed, 12 insertions, 5 deletions
diff --git a/README.md b/README.md
index 6179ed6..ce385d7 100644
--- a/README.md
+++ b/README.md
@@ -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