.element {
padding: 30px;
background: #eee;
position: relative;
&:after {
position: absolute;
content:"";
width: 0;
height: 2px;
background: red;
bottom: 0;
right: 0;
left: 0;
transition: all .5s;
}
&:hover {
&:after {
width: 100%;
}
}
}
$(document).ready(function(){
$(window).scroll(function(){
var headerHeight = $('.slider').height();
if ($(this).scrollTop() >headerHeight) {
$('.header').addClass("fixed");
} else {
$('.header').removeClass("fixed");
}
});
});
.fixed {
position:fixed;
top: 0;
left: 0;
right: 0;
}