Jump to content

Link to html accordion panel


01Moonlight
 Share

Recommended Posts

You use the url to that accordion effect with the bookmark hash

< a href="theurloftheepageyouwanttogoto.html#firstlocation">click here to see the first location</a

https://www.w3schools.com/code/tryit.asp?filename=FZA3F31CHH20

paste above code in place of what's here

https://www.w3schools.com/w3css/tryit.asp?filename=tryw3css_accordion_active

Now in the address bar add #bookmarkword to the end of url and press enter. This will represent the url with hash link from another page.

Hit run

Change hash to #bookmarkpara

Hit run.

it identifies where the bookmark is! transverses up the parent element containers <p>...</p>, <section>...</section>, <article>...</article> till it reaches a div element, set in the while loop condition. It takes the div elements id and runs the myFunction() using that id as a paremeter.

 

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
 Share

×
×
  • Create New...