限时优惠活动
亲爱的苦力吧用户,我们为了回馈新老用户一直以来的鼎力支持,即日起(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. 付费素材资源,需充值后方能下载,如有任何疑问可直接联系苦力吧客服
相关资源 / 其它&杂项

javascript实现的购物车代码

这是一款js原生代码实现的在线购物车,此代码将事件监听器添加到类为“addtocart”的按钮,单击可将当前商品添加到购物车,并监听id为“emptycart”的按钮,可清空购物车。当用户单击“addtocart”按钮时,会调用“addtocart”函数。
  其它&杂项
 8347  0

jquery基于select列表菜单的穿梭框特效代码

一款select双重列表框穿梭移动插件,在两个select下拉列表中可相互穿梭移动。
  其它&杂项
 2288  0

纯css实现的文本文字增加一条垂直竖线代码

这是一款css文本文字加竖线特效,线条的粗细可以通过width和height属性进行设置。
  其它&杂项
 7517  0

jquery列表数据可按shift/ctrl键实现多选功能插件

一款支持shift键多选功能插件,使用户可以一键选中所有相关的复选框和/或使用CTRL和Shift键选择多个复选框。
  其它&杂项
 6318  0

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

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