简体   繁体   English

jQuery UI选项卡-选项卡内的调用功能重置为第一个tav

[英]jQuery UI Tabs - calling function within tab resets to the first tav

I'm using jQuery UI tabs for simple tab navigation on a page, and this works great; 我使用jQuery UI选项卡在页面上进行简单的选项卡导航,效果很好; however, I want to call a function like 但是,我想调用一个函数

function DoStuff(){  
   $("#divID").hide();
}

from within a tab. 从选项卡中。 When I click on the <a href...> which calls the DoStuff() function, I see the div being hidden, but then the current tab which I am in is closed and the first tab is opened. 当我单击调用DoStuff()函数的<a href...> ,我看到div被隐藏了,但是关闭了我所在的当前选项卡,并打开了第一个选项卡。 Why is this happening and how would I fix this? 为什么会发生这种情况,我该如何解决? Do I need to figure out which tab I am in and then select that tab after I hide the <div> ? 我是否需要弄清楚自己位于哪个选项卡中,然后在隐藏<div>之后选择该选项卡?

are you remembering to return false in your DoStuff() callback for the tag click? 您是否还记得在DoStuff()回调中为标记点击返回false? You might be reloading the page, or at least changing the hash in the url, which can have an effect on which tab you have open. 您可能正在重新加载页面,或者至少更改了URL中的哈希,这可能会影响您打开的选项卡。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM