cssAudio - Activefile-genericCSS - ActiveGeneric - ActiveHTML - ActiveImage - ActiveJS - ActiveSVG - ActiveText - Activefile-genericVideo - ActiveLovehtmlicon-new-collectionicon-personicon-teamlog-outoctocatpop-outspinnerstartv

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.

	<h3>Accessibility jQuery tabindex enter/return key "clickable" fix</h3>
	<p>Often UI elements with tabindex="0" will not respond to hitting the enter key. The easiest way to fix this is to create a simple keypress event that simulates a keypress. This hack doesn't require a fix to existing libraries. Below is jQuery Cycle 2 slide show with a pager that normally does not respond to the return key.</p>
	<div class="cycle-slideshow"  data-cycle-timeout="0" data-cycle-prev="#prev" data-cycle-next="#next" data-cycle-pager-template="<span tabindex='0'>•</span>">
		 <div class="cycle-pager"></div>
			<img src="http://www.greggant.com/emerge/codepen/bwslides/slide1.jpg" alt="Black and white slide of flower in the Columbia Gorge - photo by Greg">
			<img src="http://www.greggant.com/emerge/codepen/bwslides/slide2.jpg" alt="Black and white slide of two friends looking overlooking Lava Canyon - photo by Greg">
			<img src="http://www.greggant.com/emerge/codepen/bwslides/slide3.jpg" alt="Black and white slide Red Rocks outside of Las Vegas - photo by Greg">

	<a href=# id="prev" tabindex="0"><i class="fa fa-chevron-left" aria-hidden="true"></i>
	<a href=# id="next" tabindex="0"><i class="fa fa-chevron-right" aria-hidden="true"></i>
	<div class="cycle-pager"></div>
	<p>Note that the chevrons do not require any additional JS for the browser to trigger when focused on (tabbed to) and pressing the the enter key. A tags with a href value automatically work with most browsers. However, the spans in this example are purposely not a tags with href values to demostrate the returnKepyress script.</p>

              //CSS isn't very important to this example. The good stuff is in the JS.
.cycle-slideshow {
	width: 100%;
	img {
		max-width: 100%;
#prev, #next {
	position: absolute;
	z-index: 105;
	top: 50%;
	font-size: 40px;
	color: white;
	text-shadow: 0px 1px 2px rgba(0, 0, 0, 0.77);
#prev {left: 0;}
#next {right: 0;}
article {
position: relative; 
	max-width: 960px;
	margin: auto;
.cycle-pager {
	font-size: 32px;
	text-align: center;
	margin-top: 15px;
	span { padding-left: 5px; padding-right: 5px;}
body {
	background: black;
	color: white;
	font-family: 'Merriweather', serif;
	-webkit-font-smoothing: antialiased;
	line-height: 1.4em;
	padding: 15px;
	font-size: 14px;


           +~+   ?DN                                        
        ::ND$COW..  7I=.                                   
              ?NMNMMMMNNDN:,,,DDDDNNNDNNN8,,,,,:. ~         
               =NNMNMNNNND:::::DDDDDDDDDDN,:,,,:  =         
                NNM=8~MMDO:::::DNNNDDD7=7::::,,:  +         
                .==~~:$COW~~~:::::DNNNNN::I,::,:  =         
                 .~~:~=N::D===~~~~~~~~NN:~~~::,:  =         
                  =~~I~:::D=+?+===~~~~~==~~~~+::  ,=        
                   =~?~::~   +==+====+.++++==.:::  ?=       
                    ::N:~                I~I= =::   ??.     
                    .:N:N                  7I .:~    .?:    
                    .::,D                  =+  ~~      ..   
                     :::                   ~=  :~           
                     ,::                   ~~  ::           
                     ,:,                   ==. ~~           
                    :,::                  OD.  =~           
                   Z$~::                      COW           

              //This is a simple script for accessibility, hitting return on UI elements triggers a click
(function(jQuery) {
	"use strict";
	var Engine;
	jQuery(document).ready(function() {
		Engine = {
			ui: {
				returnKeypress: function(whichelem) {
						$(whichelem).keypress(function(e) {
							if (e.which == 13) { //Enter key pressed
								$(this).click(); //Trigger click event
					} // return keypress
			} // ui
		}; // Engine
		//Note that smart CSS selectors with this script can save you a lot of erroreous instances of this script :) 
Loading ..................