-
Anonymous
$(window).on('hashchange') Не срабатывает, когда я программно меняю хеш с помощью Jquery?
Сообщение
Anonymous »
У меня есть две функции JQuery: одна
Код: Выделить всё
$('.navbar-nav').on('click', 'a', function (event) {
event.preventDefault(); //prevents quick jumps.
var href = $.attr(this, 'href');
href = href.replace(/^\//, '');
if (href != '#') {
if ($(href).length) {
var g = $(href).offset().top - h;
$bod.animate({
scrollTop: g - 5
}, 1000,
function () { //change hash here
if (history.pushState) {
history.pushState(null, null, href);
}
else {
window.location.hash = href;
}
});
}
};
var g = $(window).width();
if (g
Подробнее здесь: [url]https://stackoverflow.com/questions/21337219/window-onhashchange-not-firing-when-i-change-the-hash-with-jquery-program[/url]
1722110406
Anonymous
У меня есть две функции JQuery: одна
[code]$('.navbar-nav').on('click', 'a', function (event) {
event.preventDefault(); //prevents quick jumps.
var href = $.attr(this, 'href');
href = href.replace(/^\//, '');
if (href != '#') {
if ($(href).length) {
var g = $(href).offset().top - h;
$bod.animate({
scrollTop: g - 5
}, 1000,
function () { //change hash here
if (history.pushState) {
history.pushState(null, null, href);
}
else {
window.location.hash = href;
}
});
}
};
var g = $(window).width();
if (g
Подробнее здесь: [url]https://stackoverflow.com/questions/21337219/window-onhashchange-not-firing-when-i-change-the-hash-with-jquery-program[/url]