Browse Source

added smooth scroll

dependabot/npm_and_yarn/acorn-5.7.4
rdrew 6 years ago
parent
commit
d05ee9de8b
  1. 18
      js/js.js
  2. 18
      src/js/js.js

18
js/js.js

@ -48,6 +48,24 @@
}); });
} }
}; };
Drupal.behaviors.footnoteScroll = {
attach: function attach(context, settings) {
$('.see-footnote').on('click',function(e) {
e.preventDefault();
var offset = 100;
var target = this.hash;
if ($(this).data('offset') != undefined) offset = $(this).data('offset');
$('html, body').stop().animate({
'scrollTop': $(target).offset().top - offset
}, 500, 'swing', function() {
// window.location.hash = target;
});
});
}
};
//<a class="see-footnote" id="footnoterefviii_3w9ys6f" href="#footnoteviii_3w9ys6f">viii</a> //<a class="see-footnote" id="footnoterefviii_3w9ys6f" href="#footnoteviii_3w9ys6f">viii</a>

18
src/js/js.js

@ -48,6 +48,24 @@
}); });
} }
}; };
Drupal.behaviors.footnoteScroll = {
attach: function attach(context, settings) {
$('.see-footnote').on('click',function(e) {
e.preventDefault();
var offset = 100;
var target = this.hash;
if ($(this).data('offset') != undefined) offset = $(this).data('offset');
$('html, body').stop().animate({
'scrollTop': $(target).offset().top - offset
}, 500, 'swing', function() {
// window.location.hash = target;
});
});
}
};
//<a class="see-footnote" id="footnoterefviii_3w9ys6f" href="#footnoteviii_3w9ys6f">viii</a> //<a class="see-footnote" id="footnoterefviii_3w9ys6f" href="#footnoteviii_3w9ys6f">viii</a>

Loading…
Cancel
Save