Skip to content

Instantly share code, notes, and snippets.

@brycejacobson
Created December 13, 2013 19:19
Show Gist options
  • Save brycejacobson/7949658 to your computer and use it in GitHub Desktop.
Save brycejacobson/7949658 to your computer and use it in GitHub Desktop.
Smooth scroll to an id and trigger Cycle2 slide change.
<a href="#slide-rio-medley" data-target="slider"></a>
<div id="slider"></div>
jQuery( '.rice a' ).on('click', function($) {
var target = "#" + jQuery(this).data('target');
jQuery('html, body').animate({
scrollTop: jQuery(target).offset().top -200
}, 1000);
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment