【发布时间】:2017-01-31 23:00:29
【问题描述】:
我正在尝试将 href url 注入到 div 中,此代码在 Chrome 中完美运行,但在 Firefox 中无法正常运行,任何关于为什么的指针?谢谢。
HTML -
<div id="content"></div>
<style>
embed, object {
height: 100%;
top: 0;
position: absolute;
width: 100%;
}
</style>
jQuery -
<script>
$(document).ready(function () {
$("li.sub-level3").click(function () {
var hrefValue = $(this).children().clone().attr("href");
history.pushState(null, null, hrefValue);
$("#content").html('<object data=' + hrefValue + ' />').css("min-height", "1000px");
$("p").css("display", "none")
$("#cookie-bar").css("display", "none")
});
});
</script>
控制台在以下函数中显示“o 未定义” -
prepareTx: function(e, t) {
var i, s, n, a, r, o = this.opts();
return o.slideCount < 2 ? void(o.timeoutId = 0) : (!e || o.busy && !o.manualTrump || (o.API.stopTransition(), o.busy = !1, clearTimeout(o.timeoutId), o.timeoutId = 0), void(o.busy || (0 !== o.timeoutId || e) && (s = o.slides[o.currSlide], n = o.slides[o.nextSlide], a = o.API.getSlideOpts(o.nextSlide), r = o.API.calcTx(a, e), o._tx = r, e && void 0 !== a.manualSpeed && (a.speed = a.manualSpeed), o.nextSlide != o.currSlide && (e || !o.paused && !o.hoverPaused && o.timeout) ? (o.API.trigger("cycle-before", [a, s, n, t]), r.before && r.before(a, s, n, t), i = function() {
o.busy = !1, o.container.data("cycle.opts") && (r.after && r.after(a, s, n, t), o.API.trigger("cycle-after", [a, s, n, t]), o.API.queueTransition(a), o.API.updateView(!0))
}, o.busy = !0, r.transition ? r.transition(a, s, n, t, i) : o.API.doTransition(a, s, n, t, i), o.API.calcNextSlide(), o.API.updateView()) : o.API.queueTransition(a))))
},
【问题讨论】:
-
FF 中的控制台在说什么?也可以尝试使用
$("li.sub-level3").on('click',function(){代替:$("li.sub-level3").click(function () { -
嗨原子控制台 - TypeError: o is undefined[了解更多] app.min.js:1:4333 e.fn.cycle.API.prepareTx app.min.js:1:4333 e .fn.cycle.API.queueTransition/s.timeoutId
-
你的代码中的“o”在哪里?
-
嗨原子,请参阅编辑后的帖子
-
试试这个:
history.pushState({}, '', hrefValue);
标签: javascript jquery html firefox