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 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

              
                  <h1>VisualKeys demo</h1>
    <ol>
      <li>
      	<abbr>ctrl</abbr>+<abbr>space</abbr>で設定したショートカット一覧を表示
      </li>
      <li>
      <abbr>ctrl</abbr>+<abbr>alt</abbr>+<abbr>b</abbr>
      	で背景を赤に変更
      </li>
      <li>
      	<abbr>ctrl</abbr>+<abbr>alt</abbr>+<abbr>g</abbr>でjsfiddleへ移動
      
      </li>
    </ol>

    <code>

    </code>
              
            
!

CSS

              
                #visualkeys {
  margin: 0;
  position: fixed;
  z-index: 2147483647;
  bottom: -10px;
  width: 99%;
  padding: 0;
  left: 0;
}
#visualkeys * {  /* don't let other styles overwrite me */
  width: auto;
  height: auto;
  border: none;
  padding: 0;
  margin: 0;
  background: transparent;
  text-align: left;
  outline: none;
}
#visualkeys em {
  font: bold 4em georgia, serif;
  color: #555;
  text-shadow: 0 0 2px black;
  margin: 0 auto 20px 0;
  width: 99%;
  text-align: center;
  display: block;
}
#visualkeys ul {
  background-color: gray;
  padding: 10px;
  border-radius: 4px;
  color: white;
  width: 320px;
  margin: 0 auto;
  border: 2px solid #555;
  box-shadow: 0px 0px 10px #999;
}
#visualkeys ul li {
  cursor: pointer;
  list-style: none;
  margin: 0 0 6px 0;
  width: 320px;
  text-shadow: 1px 1px 1px #666;
  padding: 0;
  color: #eee;
  clear: left;
  font: normal 13px sans-serif;
  line-height: 25px;
}
#visualkeys ul li i {
  width: 20px;
  padding: 0 1px;
  float: left;
  text-align: center;
  color: white;
  background: #555;
  margin: 0 5px 0 0;
  font: bold 20px monospace;
  border-radius: 2px;
  border: 1px solid #444;
}
#visualkeys ul li:hover i {
  background: #444;
}
#visualkeys ul li b {
  font: normal 18px sans-serif;
  color: white;
}
#visualkeys ul li.hide {
	display: none;
}
              
            
!

JS

              
                
/*
 * VisualKeys v.1.0.1
 */

(function($) {

  var item, visible = false, menu, fade;

  // handle keypress
  function bind(e) {
    var key = e.keyCode;

    if((e.shiftKey || e.ctrlKey) && key == 32 || key == 120 && !visible) {
      show();
      return false;
    }
    else if(visible || (e.metaKey || e.altKey) && e.ctrlKey) {
      run(key);
      return false;
    }
    else if(key == 27 && item[27]) { // 1 keystroke keys [esc], [f1-f8]
      item[key].exec(key, item[key]);
    }
  }

  // show menu if already created or build it
  function show() {
    if(menu) { // menu already exists, just show it
 			for(var key in item) {
 				$('#visualkeys.key'+ key).removeClass('hide');
 				if(item[key].hide && item[key].hide())
 					$('#visualkeys.key'+ key).addClass('hide');
 			}

 			visible = true;
      menu.show();
    }
    else {
    	build();
    }
  }

  // build the menu, them show it
  function build() {
  	var content = '', key, i, hide;

    $('body')
      .remove('#visualkeys')
      .append('<div id="visualkeys"><em></em><ul></ul></div>');

    for(key in item) {
      i = item[key];

      if(typeof parseInt(key, 10) != 'number')
      	throw Error('key should ba a number representing a keyCode');

      if(!i.text || typeof i.text != 'string')
      	throw Error('text is required and should be a string');

      if(!i.exec || typeof i.exec != 'function')
      	throw Error('exec is required and should be a function');

      if(i.hide && typeof i.hide != 'function')
      	throw Error('hide should be a function and return true|false');
      else
      	hide = i.hide && i.hide() ? 'hide' : '';

      content += '<li onclick="$.visualkeys('+ key +')" class="key'+ key
      	+' '+ hide +'">'+ i.text +'</li>';
    }

    fade = $('#visualkeys em');
    menu = $('#visualkeys ul');

    menu.hide();
    menu.html(content);

    show();
  }

  // run a selected shortcut and fade it's name
  function run(key) {
    if(!menu)
      build();

    visible = false;
    menu.hide();
    var i = item[key];

    if(!i)
      return;

    setTimeout(function(){
      i.exec(key, i);
    }, 100);

    var f = $('.key'+ key +' b').text() || '';
    fade.html(f).show().fadeOut('slow', function(){
      fade.empty();
    });
  }

  function remove() {
    $('#visualkeys').remove();
    $(document).unbind('keydown', bind);
    $('iframe').contents().unbind('keydown', bind);
  }

  function init(param) {
      menu = false;
      item = param;

      $(document).keydown(bind);

      setTimeout(function(){
        $('iframe').contents().keydown(bind);
      }, 3000); // wait for dynamic created iframes
  }

  $.visualkeys = function(param) {
    if (typeof param == 'object') {
      init(param);
    }
    else if (typeof param == 'number') { // make menu clicks work too
      run(param);
    }
    else if (param == 'remove') {
      remove();
    }
  };

})(jQuery);

$.visualkeys({


  '66' : {
    text : '<i>b</i> <b>背景を赤にします</b>',
    exec : function(){$('body').css('background','red');}
  },
  '71' : {
    text : '<i>g</i><b>jsfiddleへ移動します</b>',
    exec : function(){ location.href='http://jsfiddle.net';}
  }
});
              
            
!
999px

Console