Advertisement
Guest User

Untitled

a guest
Dec 7th, 2016
60
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. $(document).ready(function() {
  2. $('.scrollable').click(function(event) {
  3. if (window.location.pathname === "/") {
  4. event.preventDefault();
  5. }
  6. var anchor = $(this);
  7. var target;
  8. if (window.location.pathname === "/") {
  9. target = $(anchor.attr('href')).offset().top - 70;
  10. } else {
  11. window.location = "/";
  12. alert((anchor.attr('href')));
  13. target = ($("/" + anchor.attr('href'))).offset().top - 70;
  14. }
  15. $('html, body').stop().animate({scrollTop: target});
  16. });
  17. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement