|

Three lines icons

JavaScriptを使用してアイコンを実装します。

ご自由にご利用ください。

Previews

Examples html

<!-- icons -->

<div class="icons" id="id">

	<span></span>
	<span></span>
	<span></span>

</div>

<!-- /icons -->

Examples css

/* - icons - */

.icons {
	position: relative;
	width: 25px;
	height: 25px;
	margin: 0px 0px 0px 0px;
	padding: 0px 0px 0px 0px;
	background-color: rgba(0, 0, 0, 0.0);
	cursor: pointer;
	transition: all .5s;
}

.icons span {
	display: block;
	position: absolute;
	left: 0px;
	width: 100%;
	height: 2px;
	margin: 0px 0px 0px 0px;
	padding: 0px 0px 0px 0px;
	background-color: rgba(0, 0, 0, 1.0);
	border-radius: 1px 1px 1px 1px;
	transition: all .5s;
}

.icons span:nth-of-type(1) {
	top: 0px;
}

.icons span:nth-of-type(2) {
	top: 11.5px;
}

.icons span:nth-of-type(3) {
	bottom: 0px;
}

.icons:hover span {
	background-color: rgba(192, 192, 192, 1.0);
}

.icons:active span {
	background-color: rgba(0, 0, 0, 1.0);
}

#id.active {
	transform: rotate(90deg);
}


/* - /icons - */

Examples javascript

// Add the ability to switch the display of icons.(アイコンの表示を切り替える機能を追加します。)
$( function() {
	$( '.icons' ).on( 'click', function() {
		$(this).toggleClass( 'active' );
		return false;
	} );
} );

Summary

最後までご高覧いただきましてありがとうございました。

JavaScriptを使用して実装するアイコンをご紹介させていただきました。

必要に応じて各コードを変更してご自由にご利用ください。

現場からは以上でした。