Jump to content

issue with onClick event


baragan

Recommended Posts

I have an issue with jquery. I have created a panel with 4 tabs each having its own id (e.g id="tab1" to id="tab4"). When i click lets say tab4 i goes to tab 4 without any issues. the panel is in the info page and this is how the link looks like when i move the mouse over it (info.html#tab4). Now my problem is when i try to load the link from another page lets say from the home page, instead of going to the 4th tab it loads the first how can i solve this or rather what can i do to make the browser catch the id and load the 4th tab instead of the first please help me out.

Link to comment
Share on other sites

You would need the link to call the jquery which may be a problem if other people link to the tab.I would have document.onload check the URL and if #tab4 is present load jquery.

Edited by DarkxPunk
Link to comment
Share on other sites

Thanks darkx it worked though i had to use an if else statement to check the url then click the link with the corresponding id. Initialy i had it click the first link when the page loads. Now i have a very small issue with my method. Lets say the url is info.html#panel2, the page jumps to that id immidiately. Is there a way i can have it open the page normaly and that panel without necessarily jumping to that id?

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...