/    Sign up×
Community /Pin to ProfileBookmark

JS driven links for navigation

Hey guys,

I am working on a site which has a few pages with “jquery tools tabs” implemented. In my site wide navigation I am linking certain tabs on each page to become the active tab. I am currently using the following format — href=”pageName.html#active_tab_id”. This works fine except there is a page jump as expected when using jump links. My problem is that I need to keep the page from jumping at the top. I have tried some combinations of onclick with return false; and other js page link options without success. Below is how the page works:

Navigation drop down link:

[code=html]<a href=”pageName.html#active_Tab_id” onClick=”top.location=this.href;return false;”>Nav Link</a>[/code]

This links to the page:

pageName.html#active_Tab_id and jumps down to the top of the tab contents named #active_Tab_id.

I need it to open to the page with the tab contents named #active_Tab_id and stay navigated at the top of the page.

I was trying to think of a way to inject the url into the html link through an array and function.

I may have this wrong but the array would like something like this:

[code=html]var activeTab = [];
activeTab[active_Tab_id] = pageName.html#active_Tab_id’;
activeTab[active_Tab_id2] = pageName.html#active_Tab_id2′;
activeTab[active_Tab_id3] = pageName.html#active_Tab_id3′;
[/code]

As for the function, well I am a little lost on how to build it to connect to a html link.

Any help would be great.

to post a comment
JavaScript

0Be the first to comment 😎

×

Success!

Help @alann spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.20,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...