01Moonlight Posted January 11, 2019 Report Share Posted January 11, 2019 Is there a way to link to a paragraph or word in an accordion tab without using java script? Link to comment Share on other sites More sharing options...
Funce Posted January 13, 2019 Report Share Posted January 13, 2019 Link in what way? Add a hyperlink? Link to comment Share on other sites More sharing options...
dsonesuk Posted January 13, 2019 Report Share Posted January 13, 2019 Give paragraph or span surrounding the word a id ref. Then give a link a href attribute a value to that id ref beginning with hash '#' href="#idrefvaluename" Link to comment Share on other sites More sharing options...
01Moonlight Posted January 15, 2019 Author Report Share Posted January 15, 2019 Hi Dsonesuk would that be something like <p><span id="firstlocaiton">My</span>the rest of my paragraph</p> Then where I want to link from: <a href="firstlocation">click here to see the first location</a> Is this correct? Link to comment Share on other sites More sharing options...
dsonesuk Posted January 15, 2019 Report Share Posted January 15, 2019 With a hash at the beginning < a href="#firstlocation">click here to see the first location</a> Obviously these have to be in the same accordian panel to work without JavaScript. Link to comment Share on other sites More sharing options...
01Moonlight Posted January 15, 2019 Author Report Share Posted January 15, 2019 That's the problem. I have the link in another page that needs to go to the accordion file. How can I do that? I've looked at some java script from other sites but it's either for bootstrap or an accordion created using js. Link to comment Share on other sites More sharing options...
dsonesuk Posted January 16, 2019 Report Share Posted January 16, 2019 Then on the accordion page you would check if hash appears in url. Then go to element with id reference representing by hash value and open the accordion panel it is in. https://www.w3schools.com/jsref/prop_area_hash.asp https://www.w3schools.com/jsref/prop_loc_hash.asp Link to comment Share on other sites More sharing options...
01Moonlight Posted January 16, 2019 Author Report Share Posted January 16, 2019 I looked at the links, but I'm still not sure how that's going to open a panel on another page. I've done what you suggested earlier and it links to the correct page, but does not open the panel. Link to comment Share on other sites More sharing options...
dsonesuk Posted January 17, 2019 Report Share Posted January 17, 2019 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now