Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Drupal.behaviors.scrollLinks = {
- attach: function (context) {
- // Anchor in on the page, must have id="results-anchor"
- var $anchor = $('a#results-anchor', context);
- if ($anchor.length) {
- // Link to scroll to anchor, must have class="results-link"
- var $resultsLink = $('a.results-link', context);
- if ($resultsLink.length) {
- $resultsLink.on('click', function(e) {
- e.preventDefault();
- $('html,body').animate({scrollTop: $anchor.offset().top}, 'slow');
- })
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement