问题描述
。每次我在Jquery中使用scrollto时,div中都有一个黑色边框。我的导航栏位于div标题的前面,当我单击导航栏区域时,有一种方法可以使滚动条稍微抬起一点?你们能帮我吗?
这是图片:https://imgur.com/gallery/m8gz6Go
JS:
$('a[href*="#"]').not('[href="#"]').not('[href="#0"]').click(function(event) {
if (
location.pathname.replace(/^\//,'') == this.pathname.replace(/^\//,'')
&&
location.hostname == this.hostname
) {
var target = $(this.hash);
target = target.length ? target : $('[name=' + this.hash.slice(1) + ']');
if (target.length) {
event.preventDefault();
$('html,body').animate({
scrollTop: target.offset().top
},1000,function() {
var $target = $(target);
$target.focus();
if ($target.is(":focus")) {
return false;
} else {
$target.attr('tabindex','-1');
$target.focus();
};
});
}
}
});
我试图在CSS中做到这一点,但是没有用
CSS
#about-area{
border: none !important;
}
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)