在 iPad 或 iPhone 上是否可以不调用“偏移量:-195”?
$(window).bind("load", function() {
$(document).on('click', 'a[href*="#"]', function() {
var slashedHash = '#/' + this.hash.slice(1);
if (this.hash) {
if (slashedHash === location.hash) {
$.smoothScroll({
scrollTarget: this.hash,
easing: 'easeOutQuart',
speed: 2000,
offset: -195
});
} else {
$.bbq.pushState(slashedHash);
}
return false;
}
});
$(window).bind('hashchange', function(event) {
var tgt = location.hash.replace(/^#\/?/, '');
if (document.getElementById(tgt)) {
$.smoothScroll({
scrollTarget: '#' + tgt,
easing: 'easeOutQuart',
speed: 2000,
offset: -195
});
}
});
$(window).trigger('hashchange');
});
谢谢你的帮助。