Skip to content

Instantly share code, notes, and snippets.

@alucardu
Created June 8, 2014 13:57
Show Gist options
  • Save alucardu/e5f9f7acb3b42f02341a to your computer and use it in GitHub Desktop.
Save alucardu/e5f9f7acb3b42f02341a to your computer and use it in GitHub Desktop.
A Pen by Peter Boomsma.
#container-content
#content-top
#logo
%h1
clean
%ul#menu
%li
%a{:href => "#", :id => "cleanpixel"}cleanPixel
%li
%a{:href => "#", :id => "projects"}projects
%li
%a{:href => "#", :id => "contact"}contact
#content-me
%p
Content me
#content-projets
%p
Content
$("#cleanpixel").click(function (e) {
event.preventDefault();
var container = $('#container-content'),
scrollTo = $('#content-me');
container.animate({
scrollTop: scrollTo.offset().top - container.offset().top + container.scrollTop()
}, 1500, function () {});
});
$("#projects").click(function (e) {
event.preventDefault();
var container = $('#container-content'),
scrollTo = $('#content-projects');
container.animate({
scrollTop: scrollTo.offset().top - container.offset().top + container.scrollTop()
}, 1500, function () {});
});
body,html
height: 100%
#container-content
overflow: auto
height: 100%
#content-top
margin-bottom: 100%
#content-me
height: 100%
margin-bottom: 100%
#content-projects
height: 100%
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment