Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我有一个滑块按钮,它根据点击事件进行切换。当我单击窗口的其他选项卡时,我对此有疑问,我想调用一个函数,该函数将隐藏先前打开的滑块。如果窗口的当前选项卡未处于活动状态,如何调用函数?
您可以使用Page Visibility API。
有关更多信息,请查看此问题的答案。