Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function() {
- $('.scrollable').click(function(event) {
- if (window.location.pathname === "/") {
- event.preventDefault();
- }
- var anchor = $(this);
- var target;
- if (window.location.pathname === "/") {
- target = $(anchor.attr('href')).offset().top - 70;
- } else {
- window.location = "/";
- alert((anchor.attr('href')));
- target = ($("/" + anchor.attr('href'))).offset().top - 70;
- }
- $('html, body').stop().animate({scrollTop: target});
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement