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.
每次用户单击选项卡时,是否有一个我可以注册的事件,这意味着他们在我页面的选项卡上,单击另一个选项卡,然后返回到我的选项卡。
编辑: 选项卡是指浏览器选项卡,而不是 jQueryUI 选项卡。
Matijis 在评论中提供了这个答案,但我想接受它,所以在这里作为答案。
$(window).on('focus', function() { // your code });
尝试使用 jquery $(selector).focusin 或 :focus,它们的工作方式完全相同。
http://api.jquery.com/focusin/
http://api.jquery.com/focus-selector/