2
I’m having a doubt I’m using Wordpress
this is my jquery to pick up the link I am clicking and through an anchor ID #
it scrolls down to the desired content but need to hide everything and when click appears only 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);
}
});
Dude puts at least your HTML there, it’s kind of hard to understand what you want...
– hugocsl
I made $('. sub-menu a'). click(Function() { var Anchor; var link = $(this). attr('href'); if (link.indexof('#') !== -1) { Anchor = '#' + link.split('#'). pop(); } $('. id-sub'). slideup("slow"); if (Anchor !== Undefined) { $(Anchor). slideDown("slow"); } });
– Filipe Nickel Sala