I'm having a question I'm using Wordpress
This is my jquery to get the link that I am clicking and through an anchor ID #
it scrolls down to the desired content but I need to hide everything and when clicking only appears the content clicked.
$('.sub-menu a').click(function() {
var anchor;
var link = $(this).attr('href');
if (link.indexOf('#') !== -1) {
anchor = '#' + link.split('#').pop();
}
if (anchor !== undefined) {
show().$(anchor)
$('html, body').animate({scrollTop: $(anchor).offset().top}, 2000);
}
});