Answer the question
In order to leave comments, you need to log in
How to make scrolling to the top of the page so that the content of the new tab is read from the beginning?
Implemented standard tabs on the site on bootstrap3
When scrolling the page in the mobile version, they stick to the top edge and are always available. The problem is that when you switch to a new tab, the content of the tab does not start from the beginning, but from the moment where the previous tab was viewed. How to make scrolling to the top of the page so that the content of the new tab is read from the beginning?
function stickMenu() {
var windowTop = $(window).scrollTop();
var sectionStarts = $('#sectionStarts').offset().top;
var sectionEnds = $('#sectionEnds').offset().top;
if (windowTop > sectionEnds) {
$('ul.nav.nav-tabs').removeClass('fixed');
} else if (windowTop > sectionStarts) {
$('ul.nav.nav-tabs').addClass('fixed');
} else {
$('ul.nav.nav-tabs').removeClass('fixed');
}
}
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question