mirror of
https://github.com/reddit-archive/reddit.git
synced 2026-01-27 07:48:16 -05:00
r.ui.Bubble: Add anchored-top-centered bubble mode.
This commit is contained in:
@@ -1060,6 +1060,24 @@ a.author { margin-right: 0.5em; }
|
||||
}
|
||||
}
|
||||
|
||||
&.anchor-top-centered {
|
||||
&:before, &:after {
|
||||
left: 50%;
|
||||
margin-left: -9px;
|
||||
border: 9px solid transparent;
|
||||
}
|
||||
|
||||
&:before {
|
||||
top: -19px;
|
||||
border-bottom-color: gray;
|
||||
}
|
||||
|
||||
&:after {
|
||||
top: -18px;
|
||||
border-bottom-color: white;
|
||||
}
|
||||
}
|
||||
|
||||
&.anchor-right {
|
||||
&:before, &:after {
|
||||
top: 8px;
|
||||
|
||||
@@ -179,7 +179,7 @@ r.ui.Bubble = Backbone.View.extend({
|
||||
var parentPos = this.$parent.offset(),
|
||||
bodyOffset = $('body').offset(),
|
||||
offsetX, offsetY
|
||||
if (this.$el.is('.anchor-top')) {
|
||||
if (this.$el.is('.anchor-top') || this.$el.is('.anchor-top-centered')) {
|
||||
offsetX = this.$parent.outerWidth(true) - this.$el.outerWidth(true)
|
||||
offsetY = this.$parent.outerHeight(true) + 5
|
||||
this.$el.css({
|
||||
@@ -265,7 +265,7 @@ r.ui.Bubble = Backbone.View.extend({
|
||||
}
|
||||
|
||||
var animProp, animOffset
|
||||
if (this.$el.is('.anchor-top')) {
|
||||
if (this.$el.is('.anchor-top') || this.$el.is('.anchor-top-centered')) {
|
||||
animProp = 'top'
|
||||
animOffset = '-=5'
|
||||
} else if (this.$el.is('.anchor-right')) {
|
||||
|
||||
Reference in New Issue
Block a user