Hello I have two functions which are working. I understand a little about how programming works but I dont have background in javascript or jquery (idk).
This function opens a nav tab-content:
<script> function homeTab() {
$('[href="#nav-home"]').tab('show');
}
</script>
This function auto scrolls to the shopping div at the bottom:
<script>
$('#nav-shop-tab').click(function () {
var sectionTo = $(this).attr('href');
$('html, body').animate({
scrollTop: $(sectionTo).offset().top
}, 1500);
});
</script>
Functions above are all working
Home and Shop are in the same page. Shop is in bottom
This is the about tab
What I want is how can I merge these two functions? so that when I click a button(SHOP at GCO) it will first open the "home" tab then scroll down to the shopping div?
Is it possible? I’m open to other solutions as well so that I can learn more. Thanks
you can add id to the shopping div, and on route insert the div on the url, for exmaple
if you go on this link https://en.wikipedia.org/wiki/JavaScript#The_rise_of_JScript it will take you to the div where the id is The_rise_of_JScript, try doing that and it will work