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. You can use the CSS from another Pen by using it's URL and the proper URL extention.

+ add another resource

JavaScript

Babel includes JSX processing.

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

Packages

Add Packages

Search for and use JavaScript packages from npm here. By selecting a package, an import statement will be added to the top of the JavaScript editor for this package.

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 id="sidemenu" class="sidemenu">

    <div id="sideMenuItem0" class="chapterMod">
        <div id="IDS_navItemLabel1" class="moduleBtn">
            <a href="#">*INTRODUCTION VIDEO</a>
        </div>
    </div>
    
    <div id="sideMenuItem1" class="chapterMod">
        <div id="IDS_navItemLabel2" class="moduleBtn">
            <a href="#">*SECTION MODULE 1</a>
        </div>
        <div id="IDS_Section1Chapter1" class="boxBtn">
            <a href="#IDS_Section1Chapter1">01  *Intro to Advanced EVs</a>
        </div>
        <div id="dataReviewBtn" class="boxBtn">
            <a href="#dataReviewIDS_navItemLabel2">02  *Data Review</a>
        </div>
    </div>
    
    <div id="sideMenuItem2" class="chapterMod">
        <div id="IDS_navItemLabel3" class="moduleBtn">
            <a href="#">*SECTION MODULE 2</a>
        </div>
        <div id="IDS_Section2Chapter1" class="boxBtn">
            <a href="#IDS_Section2Chapter1">01  *Volts / Amps / Resistance</a>
        </div>
        <div id="IDS_Section2Chapter2" class="boxBtn">
            <a href="#IDS_Section2Chapter2">02  *DC vs. AC</a>
        </div>
        <div id="IDS_Section2Chapter3" class="boxBtn">
            <a href="#IDS_Section2Chapter3">03  *Electrical Circuits</a>
        </div>
        <div id="IDS_Section2Chapter4" class="boxBtn">
            <a href="#IDS_Section2Chapter4">04  *Electricity and the Body</a>
        </div>
        <div id="dataReviewBtn" class="boxBtn">
            <a href="#dataReviewIDS_navItemLabel3">05  *Data Review</a>
        </div>
    </div>
    
    <div id="sideMenuItem3" class="chapterMod">
        <div id="IDS_navItemLabel4" class="moduleBtn">
            <a href="#">*SECTION MODULE 3</a>
        </div>
        <div id="IDS_Section3Chapter1" class="boxBtn">
            <a href="#IDS_Section3Chapter1">01  *Categories of EVs</a>
        </div>
        <div id="IDS_Section3Chapter2" class="boxBtn">
            <a href="#IDS_Section3Chapter2">02  *Vehicle components 1</a>
        </div>
        <div id="IDS_Section3Chapter3" class="boxBtn">
            <a href="#IDS_Section3Chapter3">03  *Vehicle components 2</a>
        </div>
        <div id="IDS_Section3Chapter4" class="boxBtn">
            <a href="#IDS_Section3Chapter4">04  *System ChaHging Stations</a>
        </div>
        <div id="dataReviewBtn" class="boxBtn">
            <a href="#dataReviewIDS_navItemLabel4">05  *Data Review</a>
        </div>
    </div>
    
    <div id="sideMenuItem4" class="chapterMod">
        <div id="IDS_navItemLabel5" class="moduleBtn">
            <a href="#">*SECTION MODULE 4</a>
        </div>
        <div id="IDS_Section4Chapter1" class="boxBtn">
            <a href="#IDS_Section4Chapter1">01  *Initial Response Procedures</a>
        </div>
        <div id="IDS_Section4Chapter2" class="boxBtn">
            <a href="#IDS_Section4Chapter2">02  *Identify</a>
        </div>
        <div id="IDS_Section4Chapter3" class="boxBtn">
            <a href="#IDS_Section4Chapter3">03  *Immobilize</a>
        </div>
        <div id="IDS_Section4Chapter4" class="boxBtn">
            <a href="#IDS_Section4Chapter4">04  *Disable</a>
        </div>
        <div id="IDS_Section4Chapter5" class="boxBtn">
            <a href="#IDS_Section4Chapter5">05  *Other considerations</a>
        </div>
        <div id="dataReviewBtn" class="boxBtn">
            <a href="#dataReviewIDS_navItemLabel5">06  *Data Review</a>
        </div>
    </div>
    
    <div id="sideMenuItem5" class="chapterMod">
        <div id="IDS_navItemLabel6" class="moduleBtn">
            <a href="#">*SECTION MODULE 5</a></div>
        <div id="IDS_Section5Chapter1" class="boxBtn">
            <a href="#IDS_Section5Chapter1">01  *Crashes / Extrications</a>
        </div>
        <div id="IDS_Section5Chapter2" class="boxBtn">
            <a href="#IDS_Section5Chapter2">02  *Submersions / Fires</a>
        </div>
        <div id="dataReviewBtn" class="boxBtn">
            <a href="#dataReviewIDS_navItemLabel6">03  *Data Review</a>
        </div>
    </div>
    
    <div id="sideMenuItem6" class="chapterMod">
        <div id="IDS_navItemLabel7" class="moduleBtn">
            <a href="#">*SCENARIO ROOM</a>
        </div>
    </div>
</div>
              
            
!

CSS

              
                html {
	background-color: rgba(23,66,85,1);
}

body,div,p {
	padding:0;
	font-family: Helvetica, sans-serif;
	font-size:13px;
}

.sidemenu {
	position:relative;
	top:0px;
	left:0px;
	width:230px;
	z-index:100;
}

.moduleBtn {
	display:block;
	margin-left:0;
	padding: 2px 2px 2px 5px;
	background-color:rgba(255,255,255,0);
	width:165px;
	cursor:pointer;
}

/*.activeMod {
    background-color:rgba(255,255,255,.4);
}*/

.moduleBtn a {
	text-decoration:none;
	font-size:14px;
	color:rgba(255,255,255,0.7);
}

.boxBtn {
    display:block;
    margin-left:0;
    padding: 0px 0px 0px 18px;
    background-color:rgba(13,21,55,0.6);
    cursor:pointer;
}


.boxBtn a {
    text-decoration:none;
    font-size:13px;
    color:rgba(255,255,255,0.5);
}

/*.activeChap {
    color:rgba(255,255,255,1);
}*/
              
            
!

JS

              
                function buildSideMenu() {
  
  // HOVER & CLICK: give each .moduleBtn element its own timeline animation
        
    $(".moduleBtn").each(function(index, element){
      var hoverTl = new TimelineLite({paused:true});
      var clickTl = new TimelineLite({paused:true});
  
      hoverTl.to($(element).find("a"), 0.25, {color:"rgba(255,255,255,1)"}, 0);
      element.hvranimation = hoverTl;
  
      clickTl
        //.to(element, 0.15, {className: "+=activeMod"}, 0)
        .to($(element).find("a"), 0.25, {color:"rgba(255,255,255,1)"}, 0)
        .to(element, 0.25, {backgroundColor:"rgba(255,255,255,0.4)"}, 0);

      element.clkAnimation = clickTl;
    });
        
    //give each .boxBtn element its own timeline animation
    $(".boxBtn").each(function(index, element){
      var hoverTl = new TimelineLite({paused:true});
      var clickTl = new TimelineLite({paused:true});
  
      hoverTl.to($(element).find("a"), 0.15, {color:"rgba(255,255,255,1)"}, 0);
      element.hvranimation = hoverTl;
  
      clickTl
        //.to(element, 0.15, {className: "+=activeChap"}, 0)
        .to($("element a"), 0.15, {color:"rgba(255,255,255,1)"}, 0);

      element.clkAnimation = clickTl;
    });
        
    function over(){
      if ($(this).hasClass( "activeMod" ) || $(this).hasClass( "activeChap" )) {
        // hover not needed if already active (selected)
      } else{
        this.hvranimation.play();
      }
    }

    function out(){
      if ($(this).hasClass( "activeMod" ) || $(this).hasClass( "activeChap" )) {
        // hover not needed if already active (selected)
      } else{
        this.hvranimation.reverse();
      }
    }
        
        
    //toggle play and reverse of each button element's timeline on hover 
    $(".moduleBtn").hover(over, out);
    $(".boxBtn").hover(over, out);

    //  END HOVER


    // ACCORDION MENU ACTION
    $(".moduleBtn").click(function(event) {
      event.preventDefault();
      viewPage($(this));
  
      // reverse the active button's tween
      if ($(".activeMod")[0]) {
        $(".activeMod")[0].clkAnimation.reverse();
        $(".activeMod")[0].hvranimation.reverse();
    
        TweenLite.set($(".activeMod")[0], {className:"-=activeMod"});
      }

      this.clkAnimation.play();
      TweenLite.set(this, {className:"+=activeMod"});
      // get the chapterMod div so we can expand selected group and colapse others
      var thisModGrp = $(this).parent()[0];
      var tlboxBtn = new TimelineLite({paused:true});
  
      $(".boxBtn").each(function(index, element){
        if ($(element).parent()[0] == thisModGrp) {
          tlboxBtn.to($(element), 0.25, {autoAlpha:1, height:19}, 0);
        } else{
          tlboxBtn.to($(element), 0.25, {autoAlpha:0, height:0}, 0);
        }
    
        element.grpanimation = tlboxBtn;
        element.grpanimation.play();
      });
  
    });
    // END ACCORDION MENU ACTION


    // MENU CHAPTER SELECTION
    $(".boxBtn").click(function(event) {
      event.preventDefault();
      viewPage($(this));
  
      // reverse the active button's tween
      if ($(".activeChap")[0]) {
        $(".activeChap")[0].clkAnimation.reverse();
        $(".activeChap")[0].hvranimation.reverse();
        TweenLite.set($(".activeChap")[0], {className:"-=activeChap"});
      }

      this.clkAnimation.play();
      TweenLite.set(this, {className:"+=activeChap"});
    });

    // END MENU CHAPTER SELECTION

    // close the menu on init
    $(".moduleBtn")[0].click();
}

function viewPage(itemClicked) {
    console.log("ITEM CLICKED: test if its a MODULE item or a bocBtn item");
    console.log(itemClicked);
};

buildSideMenu();
              
            
!
999px

Console