css Audio - Active file-generic CSS - Active Generic - Active HTML - Active JS - Active SVG - Active Text - Active file-generic Video - Active header Love html icon-new-collection icon-person icon-team numbered-list123 pop-out spinner split-screen star tv

Pen Settings

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

You're using npm packages, so we've auto-selected Babel for you here, which we require to process imports and make it all work. If you need to use a different JavaScript preprocessor, remove the packages in the npm tab.

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

Use npm Packages

We can make npm packages available for you to use in your JavaScript. We use webpack to prepare them and make them available to import. We'll also process your JavaScript with Babel.

⚠️ This feature can only be used by logged in users.

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.

HTML Settings

Here you can Sed posuere consectetur est at lobortis. Donec ullamcorper nulla non metus auctor fringilla. Maecenas sed diam eget risus varius blandit sit amet non magna. Donec id elit non mi porta gravida at eget metus. Praesent commodo cursus magna, vel scelerisque nisl consectetur et.

	<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 :) 
🕑 One or more of the npm packages you are using needs to be built. You're the first person to ever need it! We're building it right now and your preview will start updating again when it's ready.
Loading ..................