mirror of
https://github.com/zulip/zulip.git
synced 2025-11-12 18:06:44 +00:00
Add a fixed: option to bootstrap.popover and use it
(imported from commit fe8768b8a320df7670c204880bffb3932568cc5e)
This commit is contained in:
@@ -76,6 +76,7 @@ function set_app_sticky_popover() {
|
|||||||
"content": templates.render('sticky_app_popover'),
|
"content": templates.render('sticky_app_popover'),
|
||||||
"html": true,
|
"html": true,
|
||||||
"trigger": "manual",
|
"trigger": "manual",
|
||||||
|
fixed: true,
|
||||||
// This is unfortunately what you have to do to set
|
// This is unfortunately what you have to do to set
|
||||||
// a custom width for a popover.
|
// a custom width for a popover.
|
||||||
"template": '<div class="popover"><div class="arrow">' +
|
"template": '<div class="popover"><div class="arrow">' +
|
||||||
|
|||||||
@@ -1242,7 +1242,8 @@ $(function () {
|
|||||||
content: templates.render('user_sidebar_actions', {'email': email,
|
content: templates.render('user_sidebar_actions', {'email': email,
|
||||||
'name': name}),
|
'name': name}),
|
||||||
placement: "left",
|
placement: "left",
|
||||||
trigger: "manual"
|
trigger: "manual",
|
||||||
|
fixed: true
|
||||||
});
|
});
|
||||||
$(e.target).popover("show");
|
$(e.target).popover("show");
|
||||||
current_user_sidebar_elem = $(e.target);
|
current_user_sidebar_elem = $(e.target);
|
||||||
@@ -1280,7 +1281,8 @@ $(function () {
|
|||||||
var ypos = $(e.target).offset().top - viewport.scrollTop();
|
var ypos = $(e.target).offset().top - viewport.scrollTop();
|
||||||
$(e.target).popover({
|
$(e.target).popover({
|
||||||
content: templates.render('stream_sidebar_actions', {'stream': subs.have(stream)}),
|
content: templates.render('stream_sidebar_actions', {'stream': subs.have(stream)}),
|
||||||
trigger: "manual"
|
trigger: "manual",
|
||||||
|
fixed: true
|
||||||
});
|
});
|
||||||
|
|
||||||
// This little function is a workaround for the fact that
|
// This little function is a workaround for the fact that
|
||||||
|
|||||||
10
zephyr/static/third/bootstrap/js/bootstrap.js
vendored
10
zephyr/static/third/bootstrap/js/bootstrap.js
vendored
@@ -1221,6 +1221,7 @@
|
|||||||
, actualHeight
|
, actualHeight
|
||||||
, placement
|
, placement
|
||||||
, tp
|
, tp
|
||||||
|
, newtop
|
||||||
|
|
||||||
if (this.hasContent() && this.enabled) {
|
if (this.hasContent() && this.enabled) {
|
||||||
$tip = this.tip()
|
$tip = this.tip()
|
||||||
@@ -1261,6 +1262,14 @@
|
|||||||
break
|
break
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (this.options.fixed) {
|
||||||
|
// If using position: fixed, position relative to top of
|
||||||
|
// viewport
|
||||||
|
newtop = tp.top - $(document).scrollTop()
|
||||||
|
tp = $.extend(tp, {top: newtop,
|
||||||
|
position: 'fixed'})
|
||||||
|
}
|
||||||
|
|
||||||
$tip
|
$tip
|
||||||
.css(tp)
|
.css(tp)
|
||||||
.addClass(placement)
|
.addClass(placement)
|
||||||
@@ -1388,6 +1397,7 @@
|
|||||||
, title: ''
|
, title: ''
|
||||||
, delay: 0
|
, delay: 0
|
||||||
, html: true
|
, html: true
|
||||||
|
, fixed: false
|
||||||
}
|
}
|
||||||
|
|
||||||
}(window.jQuery);
|
}(window.jQuery);
|
||||||
|
|||||||
Reference in New Issue
Block a user