Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@aarongustafson
Created September 14, 2016 20:05
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aarongustafson/3db151d511dd2520a7bd38f3d37c54f9 to your computer and use it in GitHub Desktop.
Save aarongustafson/3db151d511dd2520a7bd38f3d37c54f9 to your computer and use it in GitHub Desktop.
function paginate( e ) {
// find the event target
var $target = e.target;
// if the target is a next or previous link…
if ( $target.matches( '.pagination .next, .pagination .prev' ) )
{
// handle pagination
}
}
// find the main element
var $main = document.querySelector('main');
// watch for clicks and determine if we should paginate
$main.addEventListener( 'click', paginate, false );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment