Created
July 11, 2013 12:59
-
-
Save LouisWhit/5975231 to your computer and use it in GitHub Desktop.
Dynamic FAQ Maker - HTML has bootstrap tags in it. It is output after the DOM loads by JS that reads the page for h3 tags and dynamically creates the FAQ.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| var ToC = | |
| "<div class='well table-of-contents'>" + | |
| "<h2>Question's List:</h2>" + | |
| "<p>Click on any of the questions to go their corresponding answers below or you may just scroll down the page to find the answers you are looking for.</p>"+ | |
| "<ul>"; | |
| var newLine, el, title, link, id, i = 0; | |
| $('.second-level-content .span8 h3').each(function(){ | |
| el = $(this); | |
| title = el.text(); | |
| i = i+1; | |
| id = 'FAQ' + i | |
| el.addClass('relative'); | |
| el.prepend("<span id='"+id+"' style='position:absolute;top:-50px;'></span>") | |
| el.append(" <a class='faq-link' href='#custom1_mod'>Back to Top ↑</a>") | |
| link = "#" + id; | |
| newLine = | |
| "<li>" + | |
| "<a href='" + link + "'>" + | |
| title + | |
| "</a>" + | |
| "</li>"; | |
| ToC += newLine; | |
| }); | |
| ToC += | |
| "</ul>" + | |
| "</div><div class='row-fluid'><div class='span-12 dashes'> </div></div>"; | |
| $(".span8 h1").after(ToC); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment