This is likely a pretty basic question, but I'm having trouble coming up with an if/else statement for my nav-bar. I have a combination of external page links and specific IDs I want to scroll to on click in my navbar. Below is a snippet of the code I'm dealing with where I am unable to access external links because of the e.preventDefault. Basically I want to prevent default where internal linkID (and instead scroll down to that ID), and execute normally when menu option is an external link. Could I please get some help?
// if not an external link, scroll to specific ID when click on menu item
$('.webby-top-menu .navbar-nav a').click(function (e) {
e.preventDefault();
var linkId = $(this).attr('href');
scrollTo(linkId);
if ($('.navbar-toggle').is(":visible") == true) {
$('.navbar-collapse').collapse('toggle');
}
$(this).blur();
return false;
});
// stick navbar on top
$('.webby-top-menu ').stickUp();
Thank you!