Я добавил новое липкое меню и хочу, чтобы вспомогательное подменю (которое имеет смещение при загрузке) оставалось смещенным при прокрутке.
Я немного n00b, и я не понимаю.
Я использую эту ссылку как ссылку:
Jquery прокрутка, чтобы сместить целевой div при загрузке страницы
// Goddamn scroll-to links
// Get offset height depending on our sweet ass screen width
if (window.innerWidth < 768) {
var theOffset = 16;
} else if ( $(this).is(':first')) {
//var offset = $('.entry-header').height() + 30;
} else {
var theOffset = $('.subheader').height() + 30;
}
$('a[href*=#]:not([href=#])').click(function() {
//$('.subheader li').removeClass('active');
//$(this).closest('li').addClass('active');
if (location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
|| location.hostname == this.hostname) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) +']');
if (target.length) {
$('html,body').animate({
scrollTop: (target.offset().top - theOffset)
}, 500);
return false;
}
}
});
and this:
if(window.location.hash) {
$('html,body').animate({
scrollTop: $(window.location.hash).offset().top-theOffset
}, 900, 'swing');
}
Любая помощь будет оценена