Skip to content

Instantly share code, notes, and snippets.

@diegodap
Created June 27, 2014 18:58
Show Gist options
  • Select an option

  • Save diegodap/a01afe2d3e143251faad to your computer and use it in GitHub Desktop.

Select an option

Save diegodap/a01afe2d3e143251faad to your computer and use it in GitHub Desktop.
Cod barra
.barra-scroll
.container
nav.nav-header
ul
li
a.bt-menu href="#"
i.fa.fa-bars
| MENU
li
form.form-search
i.fa.fa-search
input type="text" id="dad" placeholder="buscar"
button type="submit"
i.fa.fa-chevron-right
li.right
a href="login.html"
i.fa.fa-plus
span CADASTRAR
li.right
a.bt-login href="login.html"
i.fa.fa-user
span ENTRAR
.barra-scroll
padding: .8em
padding-bottom: .2em
width: 100%
background: $bege + 10 url(/assets/images/logo-small.jpg) center no-repeat
border-bottom: 2px solid $bege
opacity: 0
top: 0
position: fixed
z-index: 1
+prefixed(transition, .5s)
ul
margin: 0
padding: 0
li
font-size: .8em
display: inline-table
top: -5px
padding-right: 10px
position: relative
a
letter-spacing: 1px
&:hover
color: $verde
i
color: $verde
.active
position: fixed
opacity: 1
top: 0
javascript:
var mainbottom = $('.logo-header').offset().top + $('.logo-header').height();
// on scroll,
$(window).on('scroll',function(){
stop = Math.round($(window).scrollTop());
if (stop > mainbottom) {
$('.barra-scroll').addClass('active');
} else {
$('.barra-scroll').removeClass('active');
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment