Skip to content

Instantly share code, notes, and snippets.

@overwine
Created August 20, 2012 17:51
Show Gist options
  • Save overwine/3406121 to your computer and use it in GitHub Desktop.
Save overwine/3406121 to your computer and use it in GitHub Desktop.
scroll function
$navs = $('#navigation a');
$navs.click(function(e) {
e.preventDefault();
alert($navs);
var target = $(this).attr('href'),
y = $(target).offset().top,
speed = 500; /*Math.abs($('window').scrollTop() - y) * .5;*/
/*alert(speed);*/
if($(window).width() >= 480){
$('html, body').animate({
scrollTop: y-160
}, speed);
alert("Buuts!");
}
else {
$('html, body').animate({
scrollTop: y-270
}, speed);
alert("Buuts 2!");
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment