Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Scrolling + jQuery Waypoints
<script src=""></script>
<!-- Download from here: -->
<script src=""></script>
<style type="text/css">
/* A box that is 500px tall */
.content {
height: 500px;
border: 1px solid black;
<div class="content" data-url="#1">
Content 1
<div class="content" data-url="#2">
Content 2
<div class="content" data-url="#3">
Content 3
<div class="content" data-url="#4">
Content 4
<div class="content" data-url="#5">
Content 5
<div class="content">
// When the user scrolls past the top of a <div> tag, change the URL.
var changeUrl = function() {
var url = $(this).data('url');
window.history.replaceState({}, '', url);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.