2017-07-19 59 views
0

我试图使用Semantic-ui Tab模块。它正在工作。Semantic-ui:单击标签时停止URL更改

HTML代码:

<div class="ui large modal" id="some-modal"> 
    <div class="ui top attached tabular menu"> 
     <div class="item" data-tab="first">first</div> 
     <div class="item" data-tab="second">second</div> 
     <div class="item" data-tab="third">third</div> 
    </div> 
    <div class="ui bottom attached tab segment" data-tab="first"> 
     first tab content 
    </div> 
    <div class="ui bottom attached tab segment" data-tab="second"> 
     second tab content 
    </div> 
    <div class="ui bottom attached tab segment" data-tab="third"> 
     third tab content 
    </div> 
</div> 

JavaScript代码:

$('.menu .item').tab(); 

什么是制造麻烦:

当任何选项卡单击默认功能是它更改页面的网址t o data-tab属性的值。例如。当有人点击标签-1时,url更改为http://localhost#/first(因为tab-1的data-tab属性值为“first”)。

有什么方法可以阻止这种情况的发生。网址的这种改变扰乱了我的其他功能。否则,我需要在我的应用程序中进行太多更改才能使其正常工作。

感谢

回答

1

按照document

只需简单设置历史假

$('.menu .item').tab({history: false}); 
+0

谢谢... :)误错过了文档的一部分。 –