Skip to content

Instantly share code, notes, and snippets.

@luisfelipe-dev
Created November 29, 2016 16:48
Show Gist options
  • Select an option

  • Save luisfelipe-dev/f0458df61ae5b3ff3b9621b41fc24a23 to your computer and use it in GitHub Desktop.

Select an option

Save luisfelipe-dev/f0458df61ae5b3ff3b9621b41fc24a23 to your computer and use it in GitHub Desktop.
Efeito no menu ao rolar :D
var _rys = jQuery.noConflict();
_rys("document").ready(function(){
_rys(window).scroll(function () {
if (_rys(this).scrollTop() > 30) {
_rys('.heading').addClass("mostrar");
} else {
_rys('.heading').removeClass("mostrar");
}
});
});
.heading.mostrar {top: 0; position: fixed;}
---
2º Modo de Fazer:
<script>
// menu ao rolar
$(window).bind('scroll', function () {
if ($(window).scrollTop() > 350) {
$(".menu_mluv_retratil").addClass('mostrar');
} else if ($(window).scrollTop() < 350) {
$(".menu_mluv_retratil").removeClass('mostrar');
}
});
</script>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment