I have a jquery navigation menu which works but only shows the div by using an anchor tag and hash
<li><a href="#first">Menu 1</a></li>
I want to have the click to go to a genuine URL rather than having it go nowhere. I have tried setting it to a <li> element in my function but it won’t show the div.
Ive been doing some reading about this and it appears you can but hashes inside your url. Such as;
<a href="test.html#first">Menu 1</a>
I want to take out the #first and be left with with the ‘test.html’ link. This should happen when i hover over the tab that will in turn show the div and give me the choice to click the tab to go to ‘test.html’ and show the div.
Not sure what it is you are trying to do but that link goes to the tag with id=“first” in the test.html page. No script required as the HTML already links to the div.
I’ll try and reword that in a manner that might be easier to solve.
You want:
the hover event of the link to show the #first section
the click event of the link to navigate to the url, without the #first fragment
If so, combining both together in the one link is mor likely to lead to confusion.
Instead, you could use a separate but related link attribute to hold one of them, such as the rel attribute.
The link works fine and does indeed go to the url I specify but by hovering over the tab ‘menu 1’ my div which has an id of ‘first’ which displays a sub menu with additional links doesn’t show.
What I need is for the user to have 2 options.
1.An option to show the hidden div, using mouseenter via jquery, to show sub menu links
I hope this explains a bit more of what I’m trying to achieve. Thanks for the help so far guys.
As a side note I have been looking at basic jquery tutorials of tab menus and every one uses the same principle of using <a href=“#tab”> to link the div and show it. Although it works, it doesn’t go anywhere just links to that initial page.I need the <a href> to link to another page but still display the div. Maybe my script doesn’t allow this.