我使用带有主题标签的Cycle2幻灯片显示允许共享特定图片,但我不希望访问者必须反复按后退按钮才能转到上一页。有没有办法让后退按钮忽略主题标签?
如果它有帮助,这里是Cycle2的hashtag插件(当然可以归功于Cycle2):
function (e) {
"use strict";
function t(t, i) {
var n;
return t._hashFence ? (t._hashFence = !1, void 0) : (n = window.location.hash.substring(1), t.slides.each(function (s) {
if (e(this).data("cycle-hash") == n) {
if (i === !0)t.startingSlide = s; else {
var o = s > t.currSlide;
t.nextSlide = s, t.API.prepareTx(!0, o)
}
return!1
}
}), void 0)
}
e(document).on("cycle-pre-initialize", function (i, n) {
t(n, !0), n._onHashChange = function () {
t(n, !1)
}, e(window).on("hashchange", n._onHashChange)
}), e(document).on("cycle-update-view", function (e, t, i) {
i.hash && "#" + i.hash != window.location.hash && (t._hashFence = !0, window.location.hash = i.hash)
}), e(document).on("cycle-destroyed", function (t, i) {
i._onHashChange && e(window).off("hashchange", i._onHashChange)
})
}
(jQuery),
/*! loader plugin for Cycle2; version: 20131121 */
非常感谢任何帮助,谢谢:)
答案 0 :(得分:1)
而不是
window.location.hash = i.hash;
使用
window.location.replace(i.hash);
这将替换当前的历史记录条目,而不是创建/添加新条目。这样,以前的历史记录条目将在整个幻灯片中保持不变。