r.ui.Bubble: Add anchored-top-centered bubble mode.

This commit is contained in:
Neil Williams
2013-10-18 22:12:50 -07:00
parent 10e2ab8b42
commit c814bb8e6b
2 changed files with 20 additions and 2 deletions

View File

@@ -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;

View File

@@ -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')) {