Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URL's added here will be added as <link>s in order, and before the CSS in the editor. If you link to another Pen, it will include the CSS from that Pen. If the preprocessor matches, it will attempt to combine them before processing.

+ add another resource

JavaScript

Babel is required to process package imports. If you need a different preprocessor remove all packages first.

Add External Scripts/Pens

Any URL's added here will be added as <script>s in order, and run before the JavaScript in the editor. You can use the URL of any other Pen and it will include the JavaScript from that Pen.

+ add another resource

Behavior

Save Automatically?

If active, Pens will autosave every 30 seconds after being saved once.

Auto-Updating Preview

If enabled, the preview panel updates automatically as you code. If disabled, use the "Run" button to update.

Format on Save

If enabled, your code will be formatted when you actively save your Pen. Note: your code becomes un-folded during formatting.

Editor Settings

Code Indentation

Want to change your Syntax Highlighting theme, Fonts and more?

Visit your global Editor Settings.

HTML

              
                <div class="container" id="content">

		<div class="row">

			
<div class="col-md-3 widget-area" id="left-sidebar" role="complementary"> <!--was col-md-4-->
	<div class="alert alert-info" role="alert">Put a Menu in the left sidebar as a widget to further customize.</div><ul id="default-menu"><li class="page_item page-item-10 page_item_has_children current_page_ancestor current_page_parent"><a href="http://192.168.33.10/wordpress/canvas-clone/parent-a/">Parent A</a>
<ul class="children">
	<li class="page_item page-item-12 current_page_item"><a href="http://192.168.33.10/wordpress/canvas-clone/parent-a/child-a/" aria-current="page">Child A</a></li>
	<li class="page_item page-item-23"><a href="http://192.168.33.10/wordpress/canvas-clone/parent-a/child-b-of-parent-a/">Child B of Parent A</a></li>
</ul>
</li>
<li class="page_item page-item-21"><a href="http://192.168.33.10/wordpress/canvas-clone/parent-b/">Parent B</a></li>
<li class="page_item page-item-2"><a href="http://192.168.33.10/wordpress/canvas-clone/">Sample Page</a></li>
</ul>
</div><!-- #secondary -->

			<div class="col-md-8 content-area" id="primary">
				<div class="edit-header"><div class="edit-btn"><a class="post-edit-link" href="http://192.168.33.10/wordpress/canvas-clone/wp-admin/post.php?post=12&amp;action=edit">Edit</a><i class="fa fa-pencil" aria-hidden="true"></i></div></div>
				<main class="site-main" id="main" role="main">

					
						<article class="post-12 page type-page status-publish hentry" id="post-12">

	<header class="entry-header">

		<h1 class="entry-title">Child A</h1>
	</header><!-- .entry-header -->

	<div class="entry-content">

	
<p>Lorem ipsum dolor sit amet, consectetur adipiscing elit. <b>Recte, inquit, intellegis.</b> Cum id quoque, ut cupiebat, audivisset, evelli iussit eam, qua erat transfixus, hastam. Nihil enim iam habes, quod ad corpus referas; <a href="http://loripsum.net/" target="_blank" rel="noopener noreferrer">Duo Reges: constructio interrete.</a> Nobis Heracleotes ille Dionysius flagitiose descivisse videtur a Stoicis propter oculorum dolorem. -, sed ut hoc iudicaremus, non esse in iis partem maximam positam beate aut secus vivendi. Venit ad extremum; Ex quo illud efficitur, qui bene cenent omnis libenter cenare, qui libenter, non continuo bene. Negabat igitur ullam esse artem, quae ipsa a se proficisceretur;</p>
<p>Hoc etsi multimodis reprehendi potest, tamen accipio, quod dant. Ego vero isti, inquam, permitto. <i>Sequitur disserendi ratio cognitioque naturae;</i> <mark>Huius, Lyco, oratione locuples, rebus ipsis ielunior.</mark> <a href="http://loripsum.net/" target="_blank" rel="noopener noreferrer">Nos commodius agimus.</a></p>
<p><a href="http://loripsum.net/" target="_blank" rel="noopener noreferrer">Non est igitur voluptas bonum.</a> Hoc est dicere: Non reprehenderem asotos, si non essent asoti. Dicet pro me ipsa virtus nec dubitabit isti vestro beato M. Utrum igitur tibi litteram videor an totas paginas commovere? Sed tempus est, si videtur, et recta quidem ad me. Illud dico, ea, quae dicat, praeclare inter se cohaerere. Haeret in salebra. Quantum Aristoxeni ingenium consumptum videmus in musicis?</p>

		
	</div><!-- .entry-content -->
  <div id="sub-nav-footer">
    <a href="" id="prev-btn" class="sub-nav-btn">Previous</a>
    <a href="" id="next-btn" class="sub-nav-btn">Next</a>
    
              </div>

	<footer class="entry-footer">

	</footer><!-- .entry-footer -->

</article><!-- #post-## -->

						
					
				</main><!-- #main -->

			</div><!-- #primary -->

		</div><!-- .row -->

	</div>
              
            
!

CSS

              
                #sub-nav-footer {
  display: block;
  width: 100%;
  height: 40px;
  background-color: red;
}

.sub-nav-btn {
  display: inline-block;
  padding: 5px 20px;
  background-color: #fff;
  margin: 2px;
}

.hidden {
  display: none;
}

#sub-nav-footer {
  border-top: 1px solid #c7cdd1;
  margin-top: 20px;
  padding-top: 15px;
  display: grid;
  grid-template-columns: 130px auto 130px;
  grid-template-rows: 50px;
}

#prev-btn {
  grid-column-start: 1;
  grid-column-end: 1;
}


#next-btn {
  grid-column-start: 3;
  grid-column-end: 3
}


.sub-nav-btn {
  width: 120px;
}

              
            
!

JS

              
                const currentPage = document.querySelectorAll('h1')[0].innerHTML;
const navList = document.querySelectorAll('#default-menu li');

buildNav(navList, currentPage)

function buildNav(navList, currentPage){
  navList.forEach((list, index) => {
    if (list.childNodes[0].innerHTML == currentPage){
      console.log(navList.length)
      console.log(index)
      if (index-1 > -1){
       let prevLink = navList[(index-1)].childNodes[0].href;  
        console.log(prevLink)
         setNavUrl('prev-btn',prevLink)
      } else {
        hideEmptyNav('prev-btn')
      }
       if (index+1 < navList.length){
        let nextLink = navList[(index+1)].childNodes[0].href;
         console.log(nextLink)
          setNavUrl('next-btn',nextLink)
       } else {
          hideEmptyNav('next-btn')
       }
    }
  })
}


function setNavUrl(id,url){
 const nav = document.getElementById(id);
 nav.href = url; 
}

function hideEmptyNav(id){
  const nav = document.getElementById(id);
  nav.classList.add('hidden')
}
              
            
!
999px

Console