aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornohros2014-04-21 20:11:57 -0300
committernohros2014-04-21 20:11:57 -0300
commitc1755b785708ba023c484e305d05c28c5640115a (patch)
tree91f3cf75233804e44fa737dddcc1fc0b76bc6bae
parent71a6f3d53961a3dd3164613cdb515321addc9b87 (diff)
parentc101e6b7b939822f29e237e60bf0a2896d5c3831 (diff)
downloadnsPopover-c1755b785708ba023c484e305d05c28c5640115a.tar.bz2
Merge pull request #7 from pads/hide-on-click-option
Add hide-on-click option (defaults to true)
-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