cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - Activehtmloctocatspinnerstartv

Pen Settings

CSS Base

Vendor Prefixing

Add External CSS

These stylesheets will be added in this order and before the code you write in the CSS editor. You can also add another Pen here, and it will pull the CSS from it. Try typing "font" or "ribbon" below.

Quick-add: + add another resource

Add External JavaScript

These scripts will run in this order and before the code in the JavaScript editor. You can also link to another Pen here, and it will run the JavaScript from it. Also try typing the name of any popular library.

Quick-add: + add another resource

Code Indentation

     

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.

            
                <div id="gc-cw"><a target="_blank" href="http://www.joeltbennett.com">&#169; 2016 &nbsp;&nbsp; | &nbsp;&nbsp; JTBennett</a>
    <a target="_blank" href="https://www.electricherald.com">Visit the <br/><span>Electric Herald </span><br/>for more.</a>
    <a target="_blank" href="http://codepen.io/devilishalchemist/">+ JS by @devilishalchemist</a>
</div>
<div id="gcWrap">
  <div id="gcFretboard">
  <div class="gcMen">
  <ul class="chords-menu">
  <li><button data-chordgroup="A_menu">A</button></li>
  <li><button data-chordgroup="B_menu">B</button></li>
  <li><button data-chordgroup="C_menu">C</button></li>
  <li><button data-chordgroup="D_menu">D</button></li>
  <li><button data-chordgroup="E_menu">E</button></li>
  <li><button data-chordgroup="F_menu">F</button></li>
  <li><button data-chordgroup="G_menu">G</button></li>
</ul></div>
<div class="gcSubMen">
  <ul class="chords-subgroups">
</ul>
    </div>

    <div id="gc-string-E" class="gc-string">
    <div id="Note_E" class="gcinv"></div></div>
    <div id="gc-string-A" class="gc-string">
        <div id="Note_A" class="gcinv"></div></div>
    <div id="gc-string-D" class="gc-string">
      <div id="Note_D" class="gcinv"></div></div>
    <div id="gc-string-G" class="gc-string">
      <div id="Note_G" class="gcinv"></div></div>
    <div id="gc-string-B" class="gc-string">
      <div id="Note_B" class="gcinv"></div></div>
    <div id="gc-string-E2" class="gc-string">
      <div id="Note_E2" class="gcinv"></div></div>
    
<div class="chord">
  <div id='gcInfTit'><div id="tit1">NAME</div><div id="tit2">AKA</div><div id="tit3">STRUCTURE</div></div>
  <div id="inf"></div>
</div>
  </div>
  
</div> <!---gcWrap--->
            
          
!
            
              #gcWrap {position:absolute;left:calc(50% - (781px / 2));font-family:Lato;font-size:20px;}
#gcFretboard {border:1px #666 solid; border-radius:20px; width:781px; height:300px; margin-left:auto;margin-right:auto; background-image:url('http://www.joeltbennett.com/chords2/img/bg.jpg'); background-position:0px 66px;background-size:contain;background-repeat:no-repeat;}

button {display:inline-block; z-index:1000; width:70px; margin:2px 4px; height:23px; background:#fff; border:1px #666 solid; border-radius:4px; outline:none; cursor:pointer; box-shadow:1px 1px 1px #ccc; font-weight:bold;color:#666;
-webkit-transition: all .2s ease;
-moz-transition: all .2s ease;
-ms-transition: all .2s ease;
-o-transition: all .2s ease;
transition: all .2s ease;}
button:hover {color:#c44c4c;border:1px #c44c4c solid;box-shadow:1px 1px 1px #888;}
button:active {box-shadow:1px 1px 1px #888 inset;}
.gcMen {z-index:500; width:100%; position:absolute; text-align:center; top:4px;}
.gcSubMen {z-index:500; position:absolute; background:rgba(255,255,255,.9); width:781px; border-radius:20px; top:40px;}
.chords-menu {margin:0;padding:0;}
.chords-subgroups {margin:8px 0px;padding:0;}

.chords-menu li {
    display: inline-block;
  }
.chords-subgroups li {
    display: inline-block;
  }

#inf {width:781px; position:absolute; bottom:0px;}
#gcInfTit {position:absolute; width:781px; height:10px; bottom:34px;}
#gcInfTit div {float:left;text-align:left;font-size:10px;line-height:10px;padding-left:10px;margin:0;color:#ccc;}
#tit1 {width:calc(25% - 10px);} 
#tit2 {width:calc(25% - 10px);} 
#tit3 {width:calc(50% - 10px);}
.gcNAI {float:left; height:30px; color:#c44c4c;text-align:center;font-size:14px;font-weight:bold;}
#gcName {width:25%;}
#gcAlt {width:25%;}
#gcInfo {width:50%;}




.gcbg {background-size:contain; background-repeat:no-repeat;}
.gc-string {position:absolute; width:781px; height:16px;}
.gc-note {position:absolute; height:16px; width:16px; z-index:1000;}
#gc-string-E {top:189px;
-moz-transform: rotate(.6deg);
-webkit-transform: rotate(.6deg);
-o-transform: rotate(.6deg);
-ms-transform: rotate(.6deg);
transform: rotate(.6deg);
}
#gc-string-A {top:171px;
-moz-transform: rotate(.28deg);
-webkit-transform: rotate(.28deg);
-o-transform: rotate(.28deg);
-ms-transform: rotate(.28deg);
  transform: rotate(.28deg);}
#gc-string-D {top:153px;
-moz-transform: rotate(-.02deg);
-webkit-transform: rotate(-.02deg);
-o-transform: rotate(-.02deg);
-ms-transform: rotate(-.02deg);
  transform: rotate(-.02deg);}
#gc-string-G {top:136px;
-moz-transform: rotate(-.25deg);
-webkit-transform: rotate(-.25deg);
-o-transform: rotate(-.25deg);
-ms-transform: rotate(-.25deg);
  transform: rotate(-.25deg);}
#gc-string-B {top:119px;
-moz-transform: rotate(-.55deg);
-webkit-transform: rotate(-.55deg);
-o-transform: rotate(-.55deg);
-ms-transform: rotate(-.55deg);
  transform: rotate(-.55deg);}
#gc-string-E2 {top:101px;
-moz-transform: rotate(-.95deg);
-webkit-transform: rotate(-.95deg);
-o-transform: rotate(-.95deg);
-ms-transform: rotate(-.95deg);
  transform: rotate(-.95deg);}

.fret-X {left:0;}
.fret-0 {left:0;}
.fret-1 {left:42px;}
.fret-2 {left:119px;}
.fret-3 {left:190px;}
.fret-4 {left:257px;}
.fret-5 {left:321px;}
.fret-6 {left:378px;}
.fret-7 {left:434px;}
.fret-8 {left:486px;}
.fret-9 {left:536px;}
.fret-10 {left:582px;}
.fret-11 {left:627px;}
.fret-12 {left:669px;}
.fret-13 {left:710px;}
.fret-14 {left:747px;}

.E-X, .A-X, .D-X, .G-X, .B-X, .E2-X {background-image:url('http://www.joeltbennett.com/chords2/img/X.png');}
.A-0,.A-12,.E-5,.D-7,.G-2,.G-14,.B-10,.E2-5 {background-image:url('http://www.joeltbennett.com/chords2/img/A.png');}
.E-6,.A-1,.A-13,.D-8,.G-3,.B-11,.E2-6 {background-image:url('http://www.joeltbennett.com/chords2/img/As.png');}
.B-0,.B-12,.E-7,.A-2,.A-14,.D-9,.G-4,.E2-7 {background-image:url('http://www.joeltbennett.com/chords2/img/B.png');}
.E-8,.A-3,.D-10,.G-5,.B-1,.B-13,.E2-8 {background-image:url('http://www.joeltbennett.com/chords2/img/C.png');}
.E-9,.A-4,.D-11,.G-6,.B-2,.B-14,.E2-9 {background-image:url('http://www.joeltbennett.com/chords2/img/Cs.png');}
.D-0,.D-12,.E-10,.A-5,.G-7,.B-3,.E2-10 {background-image:url('http://www.joeltbennett.com/chords2/img/D.png');}
.E-11,.A-6,.D-1,.D-13,.G-8,.B-4,.E2-11 {background-image:url('http://www.joeltbennett.com/chords2/img/Ds.png');}
.E-0,.E-12,.A-7,.D-2,.D-14,.G-9,.B-5,.E2-0,.E2-12 {background-image:url('http://www.joeltbennett.com/chords2/img/E.png');}
.E-1,.E-13,.A-8,.D-3,.G-10,.B-6,.E2-1,.E2-13 {background-image:url('http://www.joeltbennett.com/chords2/img/F.png');}
.E-2,.E-14,.A-9,.D-4,.G-11,.B-7,.E2-2,.E2-14 {background-image:url('http://www.joeltbennett.com/chords2/img/Fs.png');}
.G-0,.G-12,.E-3,.A-10,.D-5,.B-8,.E2-3 {background-image:url('http://www.joeltbennett.com/chords2/img/G.png');}
.E-4,.A-11,.D-6,.G-1,.G-13,.B-9,.E2-4 {background-image:url('http://www.joeltbennett.com/chords2/img/Gs.png');}

.gcinv {opacity:0;}
.gcop {opacity:1;}
.trans {
-webkit-transition: all 1s ease;
-moz-transition: all 1s ease;
-ms-transition: all 1s ease;
-o-transition: all 1s ease;
transition: all 1s ease;
}
#gc-cw {font-family:lato; position:absolute; top:0; left:20px; font-size:10px;}
#gc-cw a {text-decoration:none; color:#000; display:block; margin-top:8px; width:100%;text-align:center;
-webkit-transition: all .2s ease;
-moz-transition: all .2s ease;
-ms-transition: all .2s ease;
-o-transition: all .2s ease;
transition: all .2s ease;}
#gc-cw a:hover {outline:10px #fff solid;color:#c44c4c;}
#gc-cw a:active {outline:1px #f00 solid;}
#gc-cw a span {font-weight:bold;font-size:11px;line-height:11px;}
            
          
!
            
              var initChordApp = function(json) {
  var chords = json[0];
  var chordGroups = Array.from(document.querySelectorAll('[data-chordgroup]'));
  var elSubgroups = document.querySelector('.chords-subgroups');
  var elChord = document.querySelector('.chord');
  var gcInfo = document.querySelector('#inf');
  var Estring = document.querySelector("#Note_E");
  var Astring = document.querySelector("#Note_A");
  var Dstring = document.querySelector("#Note_D");
  var Gstring = document.querySelector("#Note_G");
  var Bstring = document.querySelector("#Note_B");
  var E2string = document.querySelector("#Note_E2");
  var currentGroup;
  
  var emptySubgroupsEl = function() {
    while (elSubgroups.hasChildNodes()) {
      elSubgroups.removeChild(elSubgroups.lastChild);
    }
  };
  var openChord = function(chordObject) {
    // handle switching chords here
    emptySubgroupsEl();
    gcInfo.innerHTML = "<div id='gcName' class='gcNAI'>" + chordObject.name + "</div><div id='gcAlt' class='gcNAI'>" + chordObject.alt + "</div><div id='gcInfo' class='gcNAI'>" + chordObject.info + "</div>";
  var Efret = "fret-"+chordObject.E;
  var Enote = "E-"+chordObject.E;
  var Afret = "fret-"+chordObject.A;
  var Anote = "A-"+chordObject.A;
  var Dfret = "fret-"+chordObject.D;
  var Dnote = "D-"+chordObject.D;
  var Gfret = "fret-"+chordObject.G;
  var Gnote = "G-"+chordObject.G;
  var Bfret = "fret-"+chordObject.B;
  var Bnote = "B-"+chordObject.B;
  var E2fret = "fret-"+chordObject.E2;
  var E2note = "E2-"+chordObject.E2;
 (Estring).classList = ""
Estring.classList.add("gc-note", Efret, Enote, "gcbg","trans","gcop");
 (Astring).classList = ""
Astring.classList.add("gc-note", Afret, Anote, "gcbg","trans","gcop");
 (Dstring).classList = ""
Dstring.classList.add("gc-note", Dfret, Dnote, "gcbg","trans","gcop");
 (Gstring).classList = ""
Gstring.classList.add("gc-note", Gfret, Gnote, "gcbg","trans","gcop");
 (Bstring).classList = ""
Bstring.classList.add("gc-note", Bfret, Bnote, "gcbg","trans","gcop");
 (E2string).classList = ""
E2string.classList.add("gc-note", E2fret, E2note, "gcbg","trans","gcop");
  };
  
  
  var attachSubgroup = function(name) {
    var li = document.createElement('li');
    var button = document.createElement('button');
    button.innerHTML = name;
    li.appendChild(button);
    elSubgroups.appendChild(li);
  };
  var listSubgroups = function(subgroups) {
    currentGroup = subgroups;
    emptySubgroupsEl();
    for (var subgroup in subgroups) {
      if (subgroups.hasOwnProperty(subgroup)) {
        attachSubgroup(subgroup);
      }
    }
  };
  var openGroup = function(event) {
    var group = event.target.getAttribute('data-chordgroup');
    var subgroups = chords[group];
    listSubgroups(subgroups);
  };
  var openSubgroup = function(event) {
    var element = event.target;
    var button2 = document.querySelector('button');
    if (element.tagName !== 'BUTTON') { element = element.parentElement; } {
      var nextObject = currentGroup[element.innerHTML];
      if (nextObject.hasOwnProperty('sub_menu')) {
        listSubgroups(nextObject.sub_menu);
      } else {
        openChord(nextObject);
      }
    }
  };
  chordGroups.forEach(function(group) {
    group.addEventListener('click', openGroup);
  });
  elSubgroups.addEventListener('click', openSubgroup);
};


var dataUrl = 'http://codepen.io/JTBennett/pen/EZYqNo.js';
fetch(dataUrl)
  .then(function(response) {
    if (response.ok) {
      return response.json();
    }
  })
  .then(function(json) {
    initChordApp(json);
  })
  .catch(function(err) {
    console.error(err);
  });
            
          
!
999px
Close

Asset uploading is a PRO feature.

As a PRO member, you can drag-and-drop upload files here to use as resources. Images, Libraries, JSON data... anything you want. You can even edit them anytime, like any other code on CodePen.

Go PRO

Loading ..................

Console