下線のぐいーん / 2014/04/20

HTML

ソース参照

CSS

ul {
	list-style: none;
}

ul li {
	margin-bottom: 5px;
	font-size: 24px;
	line-height: 1.6;
	font-weight: bold;
	position: relative;
	overflow: hidden;
}

ul li a {
	color: #999;
	text-decoration: none;
}

ul li a:hover {
	color: #000;
}

ul li span {
	position: absolute;
	bottom: 0;
	background: #000;
	height: 1px;
}

JS

$(function(){
	$('li a').each(function(){
		$(this).after('')
	});
	$('li a').mouseover(function(){
		var span = $(this).parent().children('span');
		var listWidth = $(this).width();
		span.css({'width':listWidth+'px','left':'-'+listWidth+'px'});
		span.stop().animate({'left':'0'},600,'easeOutExpo');
	}).mouseout(function() {
		var span = $(this).parent().children('span');
		var listWidth = $(this).width();
		span.stop().animate({'left':'-'+listWidth+'px'},300,'easeOutQuint');
	});
});