当切换到Bootstrap中的另一个选项卡时,用户始终会开始查看顶部的选项卡内容。我想知道是否有一种方法可以滚动到返回到选项卡时用户先前查看的位置。
细节:
我这样定义了选项卡列表:
<ul id="main_tab" class="nav nav-tabs">
<li class="active"><a href="#users_tab_content" data-toggle="tab">Users</a></li>
Then there are more <li> values under the <ul>.
Then the content starts like so:
<div id="main_tab_content" class="tab-content">
<div class="tab-pane fade in active" id="users_tab_content">
Of course, with more <div> content tabs under the main <div>.
最佳答案
不查看任何代码就很难猜测您在说什么。您是否使用常规标签或JavaScript标签?
我会直觉,猜测您正在使用JavaScript选项卡。这不应该发生,因此我建议您仔细查看标记。通常,JS中有一个preventDefault()
调用可阻止页面跳转。
确保在链接中正确引用了您的ID:
<a href="#some_location">
关于javascript - 有Twitter Bootstrap选项卡时,请转到另一个选项卡,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/12919867/