限时优惠活动
亲爱的苦力吧用户,我们为了回馈新老用户一直以来的鼎力支持,即日起(2025-02-06至2025-03-06)凡是购买苦力吧VIP/充值K币的新老用户,都直接可获得买一送一的优惠馈赠。例如:购买一个月的VIP会员可直接获得两个月的VIP会员;充值100K币可直接获得200K币,以此类推!有任何疑问可联系在线客服,感谢各位用户对苦力吧素材的信任与厚爱,我们将一如既往的给大家上新更多优质的素材源码,祝大家开工大吉、工作顺利、心想事成。

jquery当浏览器切换到其它标签页时更改标题

所属分类: 网页特效-其它&杂项    2024-02-04 09:50:08

jquery当浏览器切换到其它标签页时更改标题 ie兼容6
 查看演示  登录后下载 温馨提示
登录会员即可享受免费下载
 我要建站

jquery当浏览器切换到其它标签页时更改标题(共2个文件)

    • funtabify.js
    • index.html

使用方法

class funtabify {
	constructor(switchTitle) {
		jQuery(document).ready(function($) {

		(function() {
				var hidden = "hidden";
				var oldtitle = document.title;
				var currenttitle;

				// Standards based on browsers:
				if (hidden in document)
					document.addEventListener("visibilitychange", onchange);
				else if ((hidden = "mozHidden") in document) // For Mozilla Firefox
					document.addEventListener("mozvisibilitychange", onchange);
				else if ((hidden = "webkitHidden") in document) // For Chrome, Safari etc.
					document.addEventListener("webkitvisibilitychange", onchange);
				else if ((hidden = "msHidden") in document)
					document.addEventListener("msvisibilitychange", onchange);
				// IE 9 and lower:
				else if ("onfocusin" in document)
					document.onfocusin = document.onfocusout = onchange;
				// All others:
				else
					window.onpageshow = window.onpagehide
						= window.onfocus = window.onblur = onchange;

			   //if tab change happens set status to either hidden or visible
				function onchange (evt) {
					var v = "visible", h = "hidden",
						evtMap = {   //check events and set status based on event type
							focus:v, focusin:v, pageshow:v, blur:h, focusout:h, pagehide:h
						};

					evt = evt || window.event;
					if (evt.type in evtMap) {  // check the title
						currenttitle = oldtitle;
						$(document).attr('title', currenttitle);
					}
					else { // We are in hidden state so create unique title
						currenttitle = this[hidden] ? switchTitle : oldtitle; //update to whatever you want
						$(document).attr('title', currenttitle);
					}

				}

				// set the initial state (but only if browser supports the Page Visibility API)
				if( document[hidden] !== undefined )
					onchange({type: document[hidden] ? "blur" : "focus"});
			})();
		});
  }
}

站长提示:
1. 苦力吧素材官方QQ群:950875342
2. 平台上所有素材资源,需注册登录会员方能正常下载。
3. 会员用户积极反馈网站、素材资源BUG或错误问题,每次奖励2K币
4. PHP源码类素材,如需协助安装调试,或你有二次开发需求,可联系苦力吧客服。
5. 付费素材资源,需充值后方能下载,如有任何疑问可直接联系苦力吧客服
相关资源 / 其它&杂项

jquery区域鼠标右键菜单插件contextmenu.js

自定义div标签区域内容,添加自定义右键菜单,多种不同样式特效!
  其它&杂项
 8381  0

jquery支持初始化和单击事件改变div标签class插件

页面加载完成时,可初始化修改div指定标签的css样式;还可绑定单击事件来操作class。
  其它&杂项
 7279  0

CSS创建的6种不同的对角线分区特效代码

使用CSS创建对角线分区的六种不同方法。不同的方法包括:使用border边框、伪元素、SVG、线性梯度和剪辑路径等。
  其它&杂项
 6343  0

jquery动态获取github自定义数据回显插件

这是一个面向开发人员的jQuery插件,它可获取你的Github存储库,并在你的网页上以优雅的自定义数据列表的形式显示出来。
  其它&杂项
 6311  0

评论数(0) 回复有机会获得K币 用户协议

^_^ 还没有人评论,快来抢个沙发!
😀
  • 😀
  • 😊
  • 😂
  • 😍
  • 😑
  • 😷
  • 😵
  • 😛
  • 😣
  • 😱
  • 😋
  • 😎
  • 😵
  • 😕
  • 😶
  • 😚
  • 😜
  • 😭
发表评论