Pen Settings

HTML

CSS

CSS Base

Vendor Prefixing

Add External Stylesheets/Pens

Any URLs 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 its URL and the proper URL extension.

+ 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 class="example">
		<div class="tabNavigation_Sample">
			<ul class="tabs" role="tablist">
			<li><a href="#tabpanel-01" id="tab-01" role="tab" tabindex="0" aria-controls="tabpanel-01" aria-selected="false">たぬき屋</a></li>
			<li><a href="#tabpanel-02" id="tab-02" role="tab" tabindex="-1" aria-controls="tabpanel-02" aria-selected="false">うどん村</a></li>
			<li><a href="#tabpanel-03" id="tab-03" role="tab" tabindex="-1" aria-controls="tabpanel-03" aria-selected="false">栄楽うどん</a></li>
			</ul>
			<div class="panels">
				<div id="tabpanel-01" class="tabpanel" role="tabpanel" area-labelledby="tab-01" aria-hidden="false">
					<p>岡山市を代表するうどん屋。店舗は東古松と北長瀬にあり、いつも賑わう地元の繁盛店である。特徴は何と言っても麺。圧力釜で素早く茹で上がるその麺は、しなやかさと柔らかさの向こうにしっかりとした弾力が感じられる極上のモチモチ麺である。僅かながら北長瀬店の方が出汁の酸味が強く感じられる。</p>
				</div>
				<div id="tabpanel-02" class="tabpanel" role="tabpanel" area-labelledby="tab-02" aria-hidden="false">
					<p>たぬき屋が岡山うどんの代表格であるなら、うどん村は讃岐うどんの代表格。店舗は奥田本町と辰巳にあり、こちらも賑わっている。麺は太くゴリゴリの男麺。冷やした麺は、食べ終わると顎が疲れるほど。讃岐ならではのイリコ出汁は、つい飲み干してしまいそうになる。ただ辰巳店が出来た頃から手打ちをやめてしまったらしく、表面のざらつきがなくなりツルっとした麺は好みが分かれるところ。</p>
				</div>
				<div id="tabpanel-03" class="tabpanel" role="tabpanel" area-labelledby="tab-03" aria-hidden="false">
					<p>倉敷市役所近くの人気店。暖簾に「讃岐の手打」と書いてはあるが、厳密には讃岐うどんではない。なか浦系と呼ばれる店の中で最も太く強いコシの麺と、透明で何味なのかよく分からない出汁の組み合わせは絶妙。メニューに無い「スペシャル」を頼むことが常連客のステイタスであり、さらに上級者は肉うどんの肉を生のままビニール袋で持ち帰るらしい。</p>
				</div>
			</div>
		</div>
	</div>
              
            
!

CSS

              
                body,div,ul,li,p{
	margin: 0;
	padding: 0;
}
li{
	list-style-type: none;
}
body{
	background: #f4f4f4;
	font-size: 18px;
}
.tabs{
	&::after{
		content: "";
		clear: both;
		display: block;
	}
	&>li{
		&>a{
			float: left;
			width: 30%;
			padding: 10px 20px;
			background: #007799;
			border-right: 1px solid #FFF;
			color: #FFF;
			text-decoration: none;
			text-align: center;
			cursor: pointer;
			box-sizing: border-box;
			&[aria-selected="true"]{
				background: #005566;
			}
			&[aria-hidden="true"]{
				border-right: none;
			}
		}
	} 
}
.panels{
	& > div{
		padding: 20px;
		background: #005566;
		color: #FFF;
		&[aria-hidden="true"]{
			display: none;
		}
	}	
}
.example{
	padding: 10px;
	background: #FFF;
	margin: 20px auto;
	width:80%;
}
              
            
!

JS

              
                $(function(){
	var $tabs =  $('[role="tab"]');
	var $panels =  $('[role="tabpanel"]');

	$tabs.eq(0).attr('aria-selected',true);
	$panels.slice(1).attr('aria-hidden',true);

	$tabs.slice(1).attr('tabindex',-1);

	function tabOpen(e){
		var $tab = $(this);
		var panelId = $tab.attr('aria-controls');
		var $panel = $('#'+panelId);

        
		$panels.attr('tabindex','-1');
		$panel.attr('tabindex','0');

		$tabs.attr('aria-selected',false);
		$tab.attr('aria-selected',true);

		$panels.attr('aria-hidden',true);
		$panel.attr('aria-hidden',false);
	}

	$tabs.on('focus',tabOpen);

	function nextTab(e){
		var $tab = $(this).parent();

		if ($tab.next()){
			$tab.next().find('[role="tab"]').focus();
		}
	}

	function prevTab(e){
		var $tab = $(this).parent();

		if ($tab.prev()){
			$tab.prev().find('[role="tab"]').focus();
		}
	}

	function keyCheck(event){
		var $tab = $(this);
		var keyCode = event.keyCode || event.which;

		// left
		if (keyCode === 37){
			$tab.trigger('keyaction.left');
		}

		// right
		if (keyCode === 39){
			$tab.trigger('keyaction.right');
		}
	}
	$tabs
		.on('keydown',keyCheck)
		.on('keyaction.left',prevTab)
		.on('keyaction.right',nextTab);

});
              
            
!
999px

Console