Skip to content
Snippets Groups Projects
Commit 5834707a authored by srosse's avatar srosse
Browse files

OO-1127: click out of the popover close it

parent b1099d44
No related branches found
No related tags found
No related merge requests found
......@@ -56,13 +56,7 @@
<script type="text/javascript">
/* <![CDATA[ */
jQuery(function() {
jQuery("#o_link").popover({
placement : 'top',
html: true,
container: 'body',
trigger: 'click',
content: o_shareCallout
});
o_shareLinkPopup('o_link', o_shareCallout);
});
jQuery(function() {
o_QRCodePopup('o_qrcode', o_shareSocialUrl);
......
......@@ -914,6 +914,26 @@ function o_scrollToElement(elem) {
}, 1000);
}
function o_shareLinkPopup(id, text, loc) {
if(typeof(loc)==='undefined') loc = 'top';
jQuery('#' + id).popover({
placement : loc,
html: true,
trigger: 'click',
container: 'body',
content: text,
}).on('shown.bs.popover', function () {
var clickListener = function (e) {
if (jQuery(e.target).data('toggle') !== 'popover' && jQuery(e.target).parents('.popover.in').length === 0) {
jQuery('#' + id).popover('hide');
jQuery('body').unbind('click', clickListener);
}
};
jQuery('body').on('click', clickListener);
});
}
function o_QRCodePopup(id, text, loc) {
if(typeof(loc)==='undefined') loc = 'top';
jQuery('#' + id).popover({
......@@ -924,6 +944,13 @@ function o_QRCodePopup(id, text, loc) {
content: '<div id="' + id + '_pop" class="o_qrcode"></div>'
}).on('shown.bs.popover', function () {
o_info.qr = o_QRCode(id + '_pop', (jQuery.isFunction(text) ? text() : text));
var clickListener = function (e) {
if (jQuery(e.target).data('toggle') !== 'popover' && jQuery(e.target).parents('.popover.in').length === 0) {
jQuery("#" + id).popover('hide');
jQuery('body').unbind('click', clickListener);
}
};
jQuery('body').on('click', clickListener);
}).on('hidden.bs.popover', function () {
try {
o_info.qr.clear();
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment