Answer the question
In order to leave comments, you need to log in
How to fix tabs at the top of the page when scrolling the page?
Tabs are implemented somewhere in the middle of the page. It is necessary that in the mobile version, when scrolling the contents of the tabs, the tabs themselves are fixed at the top of the page and disappear when the content ends. How can this be done in jquery?
Answer the question
In order to leave comments, you need to log in
To pin tabs, you can use the css-property First option:
Define the boundaries of the contents of the tabs and check whether you need to keep the tabs pinned or not when scrolling. An example (non-optimal) of how this can be done: https://jsfiddle.net/xynk2puc/8/ Second option: you can use the jquery.appear plugin or similar to track the display of the contents of the tabs .
Then the code will be something like this:
position: fixed
$('someselector').on('appear', function(event, $appearedElements) {
// тут добавляете css для закрепления вкладок
});
$('someselector').on('disappear', function(event, $disappearedElements) {
// тут убираете css для закрепления вкладок
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question