Jquery 滚动导航栏跳过选项卡?
[……]Jquery 滚动导航栏跳过选项卡?,jquery,html,css,twitter-bootstrap,Jquery,Html,Css,Twitter Bootstrap,[……] $(文档).ready(函数(){ $(“.tabs”)。在('click',函数(事件){ 如果(this.hash!==“”){ event.preventDefault(); var hash=this.hash; $('html,body')。设置动画({ scrollTop:$(散列).offset().top },800,函数(){ window.location.hash=散列; }); } }); }); [……] 这是页面的基本代码。我不知道为什么它不能正常
$(文档).ready(函数(){
$(“.tabs”)。在('click',函数(事件){
如果(this.hash!==“”){
event.preventDefault();
var hash=this.hash;
$('html,body')。设置动画({
scrollTop:$(散列).offset().top
},800,函数(){
window.location.hash=散列;
});
}
});
});
[……]
这是页面的基本代码。我不知道为什么它不能正常工作。每当我点击技能选项卡时,它就会转到项目?为什么会这样?
我试着换了身份证,但也没用 这应该有效:
<div class="deviconsContainer divs" id="div3">
<span id="javaIcon" class="devicons devicons-java"> </span>
<span id="pythonIcon" class="devicons devicons-python"> </span>
<span id="htmlIcon" class="devicons devicons-html5"> </span>
<span id="cssIcon" class="devicons devicons-css3"></span>
</div>
</p>
</div>
<script>
$(document).ready(function(){
$(".tabs").on('click', function(event) {
if (this.hash !== "") {
event.preventDefault();
var hash = this.hash;
$('html, body').animate({
scrollTop: $(hash).offset().top
}, 800, function(){
window.location.hash = hash;
});
}
});
});
</script>
<div class="deviconsContainer divs" id="div3">
<span id="javaIcon" class="devicons devicons-java"> </span>
<span id="pythonIcon" class="devicons devicons-python"> </span>
<span id="htmlIcon" class="devicons devicons-html5"> </span>
<span id="cssIcon" class="devicons devicons-css3"></span>
</div>
</p>
</div>
.ui-widget-content[aria-hidden="true"] {
display: block !important;
height: 0px;
overflow: hidden;
}
.ui-widget-content[aria-hidden="false"] {
display: block !important;
height: auto;
}