Jump to content

Search the Community

Showing results for tags 'javascript'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Categories

  • The Initiative Services and Features
  • Forum Building and Management
  • Writing Materials
  • Being a Member
  • Software
    • IPS Character Manager
  • Coding
  • Graphics

Categories

  • Roleplay Search
  • Writing Partner Search
  • Character Home Search

Categories

  • General Update
  • Announcement
  • Articles
  • Feedback
  • Tomfoolery

Categories

  • Application Templates
  • Plotters
  • Post Templates
  • Staff Templates
  • Thread Trackers
  • Other
  • Pending Challenge Entries
  • Past Challenge Entries

Categories

  • Active Challenges
  • Archived Challenges

Categories

  • Communications
  • Contributions
  • Operations

Categories

  • Jcink Themes
  • ProBoards/FreeForums Themes
  • MyBB Themes
  • IPS Themes
  • SMF Themes
  • phpBB Themes
  • Other Themes
  • Modifications
  • Make My Life Make Sense's Files
  • Dragonriders of Pern Boards's Files
  • PHPBB Staff people's Files
  • Xenforo Staff People's Files
  • Cyberpunk and Transhumanism's Files

Blogs

  • Morrigan's Madness
  • Staff Blog
  • A pirate captain's log
  • Somnia News
  • Ghost's One-Shots
  • Bits & Bones.
  • Amelia's Blog
  • Mobydoll's Blog
  • a medieval world
  • Just a girl and her stuff....
  • Everything Super
  • Icewolf's Musings
  • Ask GR - advice for RPers
  • Loose Ends
  • Tales From The Shoebox
  • Thoughts on Roleplay
  • Salt Box
  • The Salt Mine
  • Little bit of Gothic
  • The Totally Epic and True Tales of Kit the Human
  • Obvious Blog Is Obvious
  • Fountain of Thoughts
  • Please Turn The Device Off and Back On
  • gbwhatsapp apk
  • The Veritas
  • That Necromancer Life
  • Back to the narrative jungle
  • Make My Life Make Sense's Blog
  • Dragonriders of Pern Boards's Blog
  • Cryptozoology's Blog
  • Cyberpunk and Transhumanism's Blog

Calendars

  • Community Calendar
  • Character Birthdays
  • Book Club's Events
  • Make My Life Make Sense's Events
  • Dragonriders of Pern Boards's Events
  • NaNoWriMo's Virtual Write Ins
  • Cryptozoology's Events
  • Xenforo Staff People's Events
  • Cyberpunk and Transhumanism's Events

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Discord


Twitter


Skype


NaNo House


Game of Thrones House


Bending Nation

Found 2 results

  1. Before we get started, this is what we're going to create: You can add as many articles as you like without needing to alter the script. Create Your Articles Go to webpage maker (under skins & templates) Click create new webpage Give it a page title, doesn't matter what, we're not going to see it. Give it a key, something memorable for you because you'll need it later. Set allow key to use board wrappers to No. Your contents need to include valid HTML, so wrap your paragraphs into paragraphs <p>I'm a paragraph!</p> and wrap the entire contents into a div with the class articles and it must have a unique ID. For IDs, I just use article_1 (number increasing for each new article) but you might prefer something more memorable. You will need to remember what it is. <div id="article_1" class='articles'> <p>Yay! First paragraph!</p> <p>I'm a middle paragraph</p> <p>I'm another paragraph!</p> </div> Rinse and repeat until you have the articles you want. Or just make two for the purposes of this tutorial. Create the Container The container is what will house the articles, it will also include our magical menu. Back in webpage maker (under skins & templates) Click Create a New Webpage Give it a page title, this one matters because it will appear in your nav strip. (ie. My Community -> lore) Set allow key to use board wrappers to Yes. Paste in the following code: <div id="welcome_articles"> <h1>Lore</h1> Welcome to our lore. Here you can bla bla bla. Click the links on the left to read the relevant articles. </div> <div id="article_container"> <aside> <ul class="article_container_list"> <h3>Lore Index</h3> <li><a class="container_links" href="#" data-showdiv="article_1">Link 1</a></li> <li><a class="container_links" href="#" data-showdiv="article_2">Link 2</a></li> </ul> </aside> <div class="article_content"> <% article_1 %> <% article_2 %> </div> </div> <script> $(".container_links").click(function(){ $(".articles:visible").hide(); $("#"+$(this).attr("data-showdiv")).show(); }); $('.container_links').click( function(){ if ( $(this).hasClass('active') ) { $(this).removeClass('active'); } else { $('.container_links.active').removeClass('active'); $(this).addClass('active'); } }); // following is purely to prevent page jump when user clicks on link $('a.container_links').click(function(e){ e.preventDefault(); }); </script> where <% article_1 %> and <% article_2 %> are the keys to the articles you created earlier. The javascript is already included and assuming that you don't replace your class names, it doesn't need to be altered. Besides the aforementioned keys, the most important part of the code for you is <li><a class="container_links" href="#" data-showdiv="article_1">Link 1</a></li> the data-showdiv attribute needs to be the same as one of the articles you created earlier. So, say you created an article about species and you gave it an id of species. Your link should look like this <li><a class="container_links" href="#" data-showdiv="species">Species</a></li> Once you have added the links and keys, save it. If you visit it now, you'll see that everything is displayed but clicking the link will make everything vanish except the for corresponding article. You'll also notice that the list sits on top of everything else. Time to hit the style sheets! Stylesheet Go to your stylesheets and paste in the following #welcome_articles { margin-bottom: 10px; padding: 5px; border-bottom: 1px solid rgba(0,0,0, .1); } #article_container { display: flex } #article_container .article_content { flex-grow: 2; padding: 0 20px 20px; border-left: 1px solid rgba(0,0,0, .1) } #article_container aside { padding: 10px; min-width: 15% } #article_container .articles { display: none } ul.article_container_list { list-style-type: none; margin: 0; padding: 0 } ul.article_container_list li { display: block; margin: 1px; } a.container_links { display: block; border-bottom: 1px solid rgba(0,0,0, .1); padding: 5px } a.container_links.active { padding-left: 15px } ul.article_container_list h3 { margin-top: 0 } The most important bits are #article_container { display: flex } this makes the aside and div.article_content sit next to each other. Sometimes however, the aside can look a little bit claustrophobic, so I add #article_container aside { padding: 10px; min-width: 15% } To ensure that the div.article_content grows to fill the entire space left over, I add #article_container .article_content { flex-grow: 2 } To hide all of the articles by default, I add #article_container .articles { display: none } if you are having problems with the script after adding this code, move #article_container .articles { display: none } to your guidebook page so that it sits above the scripts: ie <style> #article_container .articles { display: none } </style> <script> $(".container_links").click(function(){ $(".articles:visible").hide(); $("#"+$(this).attr("data-showdiv")).show(); }); $('.container_links').click( function(){ if ( $(this).hasClass('active') ) { $(this).removeClass('active'); } else { $('.container_links.active').removeClass('active'); $(this).addClass('active'); } }); // following is purely to prevent page jump when user clicks on link $('a.container_links').click(function(e){ e.preventDefault(); }); </script> Finally, it is useful if the displayed article's link is different from the others. To do this I add a.container_links.active { padding-left: 15px } Responsiveness Make sure your head (in the global wrappers) includes the following <meta name="viewport" content="width=device-width, initial-scale=1"> This will ensure the zoom is at 100%. If you have any fixed width elements in your header or footer you may find that that user now needs to scroll horizontally. I recommend fixing that so that those elements no longer include a fixed width. I've addressed the default fixed widths in the following code @media screen and (max-width: 979px) { body { font-size: 1rem } #wrapper { width: calc(100% - 20px); margin: 0 auto; } #article_container { display: block; } ul.article_container_list { text-align: center } #userlinks { width: 90% } ul.article_container_list li { margin-bottom: 10px } ul.article_container_list li:last-child { margin-bottom: 0 } } The important part (applicable to the guidebook) is as follows #article_container { display: block; } now the aside sits above the content. ul.article_container_list { text-align: center } we center the links (note that they automatically expand to fill the available space because we made the links into blocks earlier.) ul.article_container_list li { margin-bottom: 10px } we make the links easier to tap for a chunky finger. ul.article_container_list li:last-child { margin-bottom: 0 } but the last list item doesn't need a bottom margin, so we get rid of it. The end result for mobiles becomes this: Just want some copy and paste? <head> <meta name="viewport" content="width=device-width, initial-scale=1"> </head> <div id="welcome_articles"><h1>Lore</h1> Welcome to our lore. Here you can bla bla bla. Click the links on the left to read the relevant articles. </div> <div id="article_container"> <aside> <ul class="article_container_list"> <h3>Lore Index</h3> <li><a class="container_links" href="#" data-showdiv="article_1">Link 1</a></li> <li><a class="container_links" href="#" data-showdiv="article_2">Link 2</a></li> </ul> </aside> <div class="article_content"> <% article_1 %> <% article_2 %> </div> </div> <style> #welcome_articles { margin-bottom: 10px; padding: 5px; border-bottom: 1px solid rgba(0,0,0, .1); } #article_container { display: flex } #article_container .article_content { flex-grow: 2; padding: 0 20px 20px; border-left: 1px solid rgba(0,0,0, .1) } #article_container aside { padding: 10px; min-width: 15% } #article_container .articles { display: none } ul.article_container_list { list-style-type: none; margin: 0; padding: 0 } ul.article_container_list li { display: block; margin: 1px; } a.container_links { display: block; border-bottom: 1px solid rgba(0,0,0, .1); padding: 5px } a.container_links.active { padding-left: 15px } ul.article_container_list h3 { margin-top: 0 } @media screen and (max-width: 979px) { body { font-size: 1rem } #wrapper { width: calc(100% - 20px); margin: 0 auto; } #article_container { display: block; } ul.article_container_list { text-align: center } #userlinks { width: 90% } ul.article_container_list li { margin-bottom: 10px } ul.article_container_list li:last-child { margin-bottom: 0 } } </style> <script> $(".container_links").click(function(){ $(".articles:visible").hide(); $("#"+$(this).attr("data-showdiv")).show(); }); $('.container_links').click( function(){ if ( $(this).hasClass('active') ) { $(this).removeClass('active'); } else { $('.container_links.active').removeClass('active'); $(this).addClass('active'); } }); // following is purely to prevent page jump when user clicks on link $('a.container_links').click(function(e){ e.preventDefault(); }); </script> I hope that someone finds this useful! As already noted, any forum software can utilise this guide, the actual magic is the script and that is not software specific.
  2. <p>https://github.com/DavideTriso/aria-tabs</p>
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use, Guidelines and Privacy Policy. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.