Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript Side navi load content Reply To: Side navi load content

#150189
Paulie_D
Member

I’m just getting to learn JQuery myself and with a bit of googling I find similar examples and then try and deconstruct them.

In your case, it seems as though you have to find some way to associate each link with a particular div.

So each div should have an ID and each link should have an attribute which can be associated to that ID. I found an example that uses the `name’ attribute which works quite well.

OK…first a bit of set-up.

We hide all the divs (I used a class of test and display:none)…then we use JS/JQ to say that when each link is clicked to get the `name’ of the link and store it in a variable (divname) and then show the div with the ID that is the same as that variable.

In this Codepen, I have used the SlideUp/Down options to slide the divs in and out.

http://codepen.io/Paulie-D/pen/df562531679ef60c92dbfb2949c8b5d6

Not original on my part though, I cribbed bits of it from other places on the interwebz.