简体   繁体   English

setTimeout()函数有问题

[英]Having issues with setTimeout() function

I'm using the tabs feature from jQuery UI and I need to reload the tab after 5 seconds. 我正在使用jQuery UI中的标签页功能,并且需要5秒钟后重新加载标签页。 I currently have two methods of reloading the data: 我目前有两种重新加载数据的方法:

  1. Automatic (jQuery/JavaScript) 自动(jQuery / JavaScript)
  2. Click link 点击链接

When reloading the first time automatically and after clicking the reload link, the reload is not following the desired time of 5 seconds. 第一次自动重新加载时,单击重新加载链接后,重新加载未遵循5秒的期望时间。

Example: 例:

  1. Enter the page - Call method for automatic reload (ok working) 进入页面-自动重新加载的调用方法(可以正常使用)
  2. Pass 3 seconds - Click link for reload manual (ok working) 超过3秒-单击链接以重新加载手册(可以正常工作)
  3. Time is obeying the 5 second timeframe. 时间服从5秒的时间范围。

What options do I have? 我有什么选择?

It's hard to say without looking the code, but it seems that you need cancel the first setTimeout call before call it again using the manual action. 不看代码很难说,但是似乎您需要取消第一个setTimeout调用,然后再使用手动操作再次调用它。

Can you show the code? 你能显示代码吗?

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

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