我的锚链接滚动有问题。
如您所见,它是跳动的/浮躁的,我不知道为什么以及在哪里寻找解决方案。(使用WordPress,elementor和此功能可以平滑滚动)。
我也尝试过“ Page to Id”插件,但由于某种原因,即使我选中了阻止其他任何滚动脚本的选项,它也会变得更加跳跃并且具有怪异的行为。
您可以在这里检查:http://justbutler.sixlogics.com
感谢您的帮助。谢谢。
function smooth_scroll() {
?>
<script>
jQuery(document).ready(function($) {
$(".page-id-27 ul.primary-menu.reset-list-style li 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 - 100
}, 900);
return false;
} // End if
});
});
</script>
<?php
}
更新主题。