Javascript 使用锚定链接和jquery在节之间跳转
我有一个代码,使一个平稳的滚动与锚链接,但我想要的是使一个固定的窗口高度链接,并在页面中的每个可用部分之间跳转。我的链接显示滚动以了解更多信息。当用户单击时,必须转到每个部分。到目前为止,我的代码是:Javascript 使用锚定链接和jquery在节之间跳转,javascript,jquery,html,css,Javascript,Jquery,Html,Css,我有一个代码,使一个平稳的滚动与锚链接,但我想要的是使一个固定的窗口高度链接,并在页面中的每个可用部分之间跳转。我的链接显示滚动以了解更多信息。当用户单击时,必须转到每个部分。到目前为止,我的代码是: $("#over_scroll_text a").on('click', function(event) { // Make sure this.hash has a value before overriding default behavior //if (this.hash
$("#over_scroll_text a").on('click', function(event) {
// Make sure this.hash has a value before overriding default behavior
//if (this.hash == "") {
// Prevent default anchor click behavior
event.preventDefault();
// Store hash
//var hash = this.hash;
// Using jQuery's animate() method to add smooth page scroll
// The optional number (800) specifies the number of milliseconds it takes to scroll to the specified area
$('html, body').animate({
//scrollTop: $(hash).offset().top
scrollTop: $(document).height() - $(window).height()
//}, 800//, function(){
// Add hash (#) to URL when done scrolling (default click behavior)
//window.location.hash = hash;
});
//} // End if
});
不知道从这里我能做什么。有什么帮助吗?第9行、第16行和第19行不应该被注释掉