With the design for the snippets area "done" - we can now move into some interactivity (read: JavaScript).

We add a super lame rollover for the links on the left just so we have something, but we know we'll change that later. Then we set about actually writing some JavaScript. Upon visiting the page for the first time, the first category (HTML) will be active. Active, meaning it has the class "active" on the list item for HTML. CSS affects that class, giving it a z-index value, which visually rises the link above the shadow and connects it to the solid color line separating the two columns.

The trick is going to be when you click a different category, to remove the active class on the currently active category and apply it to the newly clicked one. It's pretty trivial really, just a few lines of jQuery in a script that we load only on this page. Also then, the list of snippets in the right column needs to show the correct set of links, which again is just some class changing and simple show/hide manipulation.

All that's left now is styling up the pages for individual snippets.

Posting Code

You may write comments in Markdown. This makes code easy to post, as you can write inline code like `<div>this</div>` or multiline blocks of code in triple backtick fences (```) with double new lines before and after.

Code of Conduct

Absolutely anyone is welcome to submit a comment here. But not all comments will be posted. Think of it like writing a letter to the editor. All submitted comments will be read, but not all published. Published comments will be on-topic, helpful, and further the discussion or debate.

Want to tell us something privately?

Feel free to use our contact form. That's a great place to let us know about typos or anything off-topic.

Submit a Comment

icon-closeicon-emailicon-linkicon-menuicon-searchicon-tag