$(document).ready(function(){
$('body a').click(function(e){
e.preventDefault();
var goTo = $(this).attr('href').replace('#','');
$('html, body').animate({
scrollTop:$('a[name="'+goTo+'"]').offset().top
},1775);
window.location.hash = "#"+goTo;
});
Run Code Online (Sandbox Code Playgroud)
我在我的代码中有这个功能来实现我页面上的滚动效果,但我认为这会影响我的图像链接.当我点击图像时,它不会链接到任何地方.我相当肯定错误在这里,但需要一些帮助找到它.
谢谢.