我需要删除引导弹出窗口的“左”值。我该怎么做?
我不需要在CSS中添加边距或更改左边的值,只需要删除它(请检查元素以查看它,它肯定是由bootstrap.js或tooltip.js添加的)。
弹出窗口示例:
http://jsfiddle.net/KyleMit/VUZhL/
下面的代码属于引导程序。js和工具提示/弹出窗口。
function b(b) {
return this.each(function() {
var d = a(this),
e = d.data("bs.tooltip"),
f = "object" == typeof b && b;
(e || "destroy" != b) && (e || d.data("bs.tooltip", e = new c(this, f)), "string" == typeof b && e[b]())
})
}
var c = function(a, b) {
this.type = this.options = this.enabled = this.timeout = this.hoverState = this.$element = null, this.init("tooltip", a, b)
};
c.VERSION = "3.2.0", c.DEFAULTS = {
animation: !0,
placement: "top",
selector: !1,
template: '<div class="tooltip" role="tooltip"><div class="tooltip-arrow"></div><div class="tooltip-inner"></div></div>',
trigger: "hover focus",
title: "",
delay: 0,
html: !1,
container: !1,
viewport: {
selector: "body",
padding: 0
}
}, c.prototype.init = function(b, c, d) {
this.enabled = !0, this.type = b, this.$element = a(c), this.options = this.getOptions(d), this.$viewport = this.options.viewport && a(this.options.viewport.selector || this.options.viewport);
for (var e = this.options.trigger.split(" "), f = e.length; f--;) {
var g = e[f];
if ("click" == g) this.$element.on("click." + this.type, this.options.selector, a.proxy(this.toggle, this));
else if ("manual" != g) {
var h = "hover" == g ? "mouseenter" : "focusin",
i = "hover" == g ? "mouseleave" : "focusout";
this.$element.on(h + "." + this.type, this.options.selector, a.proxy(this.enter, this)), this.$element.on(i + "." + this.type, this.options.selector, a.proxy(this.leave, this))
}
}
this.options.selector ? this._options = a.extend({}, this.options, {
trigger: "manual",
selector: ""
}) : this.fixTitle()
}, c.prototype.getDefaults = function() {
return c.DEFAULTS
}, c.prototype.getOptions = function(b) {
return b = a.extend({}, this.getDefaults(), this.$element.data(), b), b.delay && "number" == typeof b.delay && (b.delay = {
show: b.delay,
hide: b.delay
}), b
}, c.prototype.getDelegateOptions = function() {
var b = {},
c = this.getDefaults();
return this._options && a.each(this._options, function(a, d) {
c[a] != d && (b[a] = d)
}), b
}, c.prototype.enter = function(b) {
var c = b instanceof this.constructor ? b : a(b.currentTarget).data("bs." + this.type);
return c || (c = new this.constructor(b.currentTarget, this.getDelegateOptions()), a(b.currentTarget).data("bs." + this.type, c)), clearTimeout(c.timeout), c.hoverState = "in", c.options.delay && c.options.delay.show ? void(c.timeout = setTimeout(function() {
"in" == c.hoverState && c.show()
}, c.options.delay.show)) : c.show()
}, c.prototype.leave = function(b) {
var c = b instanceof this.constructor ? b : a(b.currentTarget).data("bs." + this.type);
return c || (c = new this.constructor(b.currentTarget, this.getDelegateOptions()), a(b.currentTarget).data("bs." + this.type, c)), clearTimeout(c.timeout), c.hoverState = "out", c.options.delay && c.options.delay.hide ? void(c.timeout = setTimeout(function() {
"out" == c.hoverState && c.hide()
}, c.options.delay.hide)) : c.hide()
}, c.prototype.show = function() {
var b = a.Event("show.bs." + this.type);
if (this.hasContent() && this.enabled) {
this.$element.trigger(b);
var c = a.contains(document.documentElement, this.$element[0]);
if (b.isDefaultPrevented() || !c) return;
var d = this,
e = this.tip(),
f = this.getUID(this.type);
this.setContent(), e.attr("id", f), this.$element.attr("aria-describedby", f), this.options.animation && e.addClass("fade");
var g = "function" == typeof this.options.placement ? this.options.placement.call(this, e[0], this.$element[0]) : this.options.placement,
h = /\s?auto?\s?/i,
i = h.test(g);
i && (g = g.replace(h, "") || "top"), e.detach().css({
top: 0,
left: 0,
display: "block"
}).addClass(g).data("bs." + this.type, this), this.options.container ? e.appendTo(this.options.container) : e.insertAfter(this.$element);
var j = this.getPosition(),
k = e[0].offsetWidth,
l = e[0].offsetHeight;
if (i) {
var m = g,
n = this.$element.parent(),
o = this.getPosition(n);
g = "bottom" == g && j.top + j.height + l - o.scroll > o.height ? "top" : "top" == g && j.top - o.scroll - l < 0 ? "bottom" : "right" == g && j.right + k > o.width ? "left" : "left" == g && j.left - k < o.left ? "right" : g, e.removeClass(m).addClass(g)
}
var p = this.getCalculatedOffset(g, j, k, l);
this.applyPlacement(p, g);
var q = function() {
d.$element.trigger("shown.bs." + d.type), d.hoverState = null
};
a.support.transition && this.$tip.hasClass("fade") ? e.one("bsTransitionEnd", q).emulateTransitionEnd(150) : q()
}
}, c.prototype.applyPlacement = function(b, c) {
var d = this.tip(),
e = d[0].offsetWidth,
f = d[0].offsetHeight,
g = parseInt(d.css("margin-top"), 10),
h = parseInt(d.css("margin-left"), 10);
isNaN(g) && (g = 0), isNaN(h) && (h = 0), b.top = b.top + g, b.left = b.left + h, a.offset.setOffset(d[0], a.extend({
using: function(a) {
d.css({
top: Math.round(a.top),
left: Math.round(a.left)
})
}
}, b), 0), d.addClass("in");
var i = d[0].offsetWidth,
j = d[0].offsetHeight;
"top" == c && j != f && (b.top = b.top + f - j);
var k = this.getViewportAdjustedDelta(c, b, i, j);
k.left ? b.left += k.left : b.top += k.top;
var l = k.left ? 2 * k.left - e + i : 2 * k.top - f + j,
m = k.left ? "left" : "top",
n = k.left ? "offsetWidth" : "offsetHeight";
d.offset(b), this.replaceArrow(l, d[0][n], m)
}, c.prototype.replaceArrow = function(a, b, c) {
this.arrow().css(c, a ? 50 * (1 - a / b) + "%" : "")
}, c.prototype.setContent = function() {
var a = this.tip(),
b = this.getTitle();
a.find(".tooltip-inner")[this.options.html ? "html" : "text"](b), a.removeClass("fade in top bottom left right")
}, c.prototype.hide = function() {
function b() {
"in" != c.hoverState && d.detach(), c.$element.trigger("hidden.bs." + c.type)
}
var c = this,
d = this.tip(),
e = a.Event("hide.bs." + this.type);
return this.$element.removeAttr("aria-describedby"), this.$element.trigger(e), e.isDefaultPrevented() ? void 0 : (d.removeClass("in"), a.support.transition && this.$tip.hasClass("fade") ? d.one("bsTransitionEnd", b).emulateTransitionEnd(150) : b(), this.hoverState = null, this)
}, c.prototype.fixTitle = function() {
var a = this.$element;
(a.attr("title") || "string" != typeof a.attr("data-original-title")) && a.attr("data-original-title", a.attr("title") || "").attr("title", "")
}, c.prototype.hasContent = function() {
return this.getTitle()
}, c.prototype.getPosition = function(b) {
b = b || this.$element;
var c = b[0],
d = "BODY" == c.tagName;
return a.extend({}, "function" == typeof c.getBoundingClientRect ? c.getBoundingClientRect() : null, {
scroll: d ? document.documentElement.scrollTop || document.body.scrollTop : b.scrollTop(),
width: d ? a(window).width() : b.outerWidth(),
height: d ? a(window).height() : b.outerHeight()
}, d ? {
top: 0,
left: 0
} : b.offset())
}, c.prototype.getCalculatedOffset = function(a, b, c, d) {
return "bottom" == a ? {
top: b.top + b.height,
left: b.left + b.width / 2 - c / 2
} : "top" == a ? {
top: b.top - d,
left: b.left + b.width / 2 - c / 2
} : "left" == a ? {
top: b.top + b.height / 2 - d / 2,
left: b.left - c
} : {
top: b.top + b.height / 2 - d / 2,
left: b.left + b.width
}
}, c.prototype.getViewportAdjustedDelta = function(a, b, c, d) {
var e = {
top: 0,
left: 0
};
if (!this.$viewport) return e;
var f = this.options.viewport && this.options.viewport.padding || 0,
g = this.getPosition(this.$viewport);
if (/right|left/.test(a)) {
var h = b.top - f - g.scroll,
i = b.top + f - g.scroll + d;
h < g.top ? e.top = g.top - h : i > g.top + g.height && (e.top = g.top + g.height - i)
} else {
var j = b.left - f,
k = b.left + f + c;
j < g.left ? e.left = g.left - j : k > g.width && (e.left = g.left + g.width - k)
}
return e
}, c.prototype.getTitle = function() {
var a, b = this.$element,
c = this.options;
return a = b.attr("data-original-title") || ("function" == typeof c.title ? c.title.call(b[0]) : c.title)
}, c.prototype.getUID = function(a) {
do a += ~~(1e6 * Math.random()); while (document.getElementById(a));
return a
}, c.prototype.tip = function() {
return this.$tip = this.$tip || a(this.options.template)
}, c.prototype.arrow = function() {
return this.$arrow = this.$arrow || this.tip().find(".tooltip-arrow")
}, c.prototype.validate = function() {
this.$element[0].parentNode || (this.hide(), this.$element = null, this.options = null)
}, c.prototype.enable = function() {
this.enabled = !0
}, c.prototype.disable = function() {
this.enabled = !1
}, c.prototype.toggleEnabled = function() {
this.enabled = !this.enabled
}, c.prototype.toggle = function(b) {
var c = this;
b && (c = a(b.currentTarget).data("bs." + this.type), c || (c = new this.constructor(b.currentTarget, this.getDelegateOptions()), a(b.currentTarget).data("bs." + this.type, c))), c.tip().hasClass("in") ? c.leave(c) : c.enter(c)
}, c.prototype.destroy = function() {
clearTimeout(this.timeout), this.hide().$element.off("." + this.type).removeData("bs." + this.type)
};
var d = a.fn.tooltip;
a.fn.tooltip = b, a.fn.tooltip.Constructor = c, a.fn.tooltip.noConflict = function() {
return a.fn.tooltip = d, this
}
}(jQuery),+函数(a){
“使用严格”;
function b(b) {
return this.each(function() {
var d = a(this),
e = d.data("bs.popover"),
f = "object" == typeof b && b;
(e || "destroy" != b) && (e || d.data("bs.popover", e = new c(this, f)), "string" == typeof b && e[b]())
})
}
var c = function(a, b) {
this.init("popover", a, b)
};
if (!a.fn.tooltip) throw new Error("Popover requires tooltip.js");
c.VERSION = "3.2.0", c.DEFAULTS = a.extend({}, a.fn.tooltip.Constructor.DEFAULTS, {
placement: "right",
trigger: "click",
content: "",
template: '<div class="popover" role="tooltip"><div class="arrow"></div><h3 class="popover-title"></h3><div class="popover-content"></div></div>'
}), c.prototype = a.extend({}, a.fn.tooltip.Constructor.prototype), c.prototype.constructor = c, c.prototype.getDefaults = function() {
return c.DEFAULTS
}, c.prototype.setContent = function() {
var a = this.tip(),
b = this.getTitle(),
c = this.getContent();
a.find(".popover-title")[this.options.html ? "html" : "text"](b), a.find(".popover-content").empty()[this.options.html ? "string" == typeof c ? "html" : "append" : "text"](c), a.removeClass("fade top bottom left right in"), a.find(".popover-title").html() || a.find(".popover-title").hide()
}, c.prototype.hasContent = function() {
return this.getTitle() || this.getContent()
}, c.prototype.getContent = function() {
var a = this.$element,
b = this.options;
return a.attr("data-content") || ("function" == typeof b.content ? b.content.call(a[0]) : b.content)
}, c.prototype.arrow = function() {
return this.$arrow = this.$arrow || this.tip().find(".arrow")
}, c.prototype.tip = function() {
return this.$tip || (this.$tip = a(this.options.template)), this.$tip
};
var d = a.fn.popover;
a.fn.popover = b, a.fn.popover.Constructor = c, a.fn.popover.noConflict = function() {
return a.fn.popover = d, this
}