Skip to content

Commit

Permalink
Add smooth scrolling functionality
Browse files Browse the repository at this point in the history
  • Loading branch information
katzmo committed Aug 30, 2018
1 parent da53560 commit 1640042
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions js/simplicity.js
Expand Up @@ -30,6 +30,7 @@ Drupal.behaviors.mobilemenu.attach = function(context, settings) {

Drupal.behaviors.showMore = {};
Drupal.behaviors.showMore.attach = function (context, settings) {
// Link for revealing more info.
$('.show-more', context).each(function () {
var $toggle = $(this);
var $target = $($toggle.attr('href'));
Expand All @@ -43,6 +44,11 @@ Drupal.behaviors.showMore.attach = function (context, settings) {
});
}
});
// Class for smooth scrolling to anchor.
$('a.scroll', context).on('click', function (e) {
$('html,body').animate({scrollTop:$(e.currentTarget.hash).offset().top}, 500);
e.preventDefault();
});
};

Drupal.behaviors.selectOrOther = {};
Expand Down

0 comments on commit 1640042

Please sign in to comment.