Created
November 7, 2018 01:11
-
-
Save Aliciabcd/8c40be0321a62bf0c42a0a9c2c4bb773 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$(document).ready(function(){ | |
href = window.location.href.match(/block=([0-9a-z\-_]*)/i) | |
if(href.length > 1){ | |
block_id = href[1] | |
$target = $("#" + block_id) | |
console.log($target.offset) | |
var targetOffset = $target.offset().top - 80; | |
$('html, body').animate({ | |
scrollTop: targetOffset | |
}, 500 ); | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment