Skip to content

Instantly share code, notes, and snippets.

@gabrieljmj
Created April 29, 2016 19:26
Show Gist options
  • Save gabrieljmj/6dff7135cabcc2ef1ab564e0fd16584c to your computer and use it in GitHub Desktop.
Save gabrieljmj/6dff7135cabcc2ef1ab564e0fd16584c to your computer and use it in GitHub Desktop.
FuckMyScroll - sample
<nav id="nav">
Go to
<a href="#cat" fmscroll>Cat</a>
<a href="#dog" fmscroll>Dog</a>
<a href="#horse" fmscroll>Horse</a>
</nav>
<div id="cat">
<img src="http://afv.com/wp-content/uploads/2014/12/confused-kitty.jpg" alt="cat image" width="400">
</div>
<div id="horse">
<img src="https://i.ytimg.com/vi/qrfcTxLP7lw/maxresdefault.jpg" alt="horse image" width="400">
</div>
<div id="dog">
<img src="http://stuffpoint.com/dogs/image/307235-dogs-cute-dog.jpg" alt="dog image" width="400">
</div>
<div id="to-top">
<a href="#nav" fmscroll><h3>Back to top</h3></a>
</div>
window.onload = function () {
const fms = new FuckMyScroll({
speed: 10,
init: function (target) {
console.log('Going to #' + target);
},
end: function (target) {
console.log('Here we are!');
}
});
fms.init();
};
<script src="https://cdn.rawgit.com/gabrieljmj/fuckmyscroll/master/dist/fuckmyscroll.js"></script>
#cat {
margin-top: 500px;
}
#dog {
margin-top: 2000px;
}
#horse {
margin-left: 2000px;
}
#cat, #dog, #horse {
float: left;
}
#to-top {
position: fixed;
bottom: 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment