简体   繁体   中英

How can I make an tab change it's title when it's active/inactive?

I noticed Mellow Mushroom's website tabs change depending on if it is active or not. I'd like to be able to reproduce this on my personal site.

Here's a video in case you don't know what I mean ---> https://imgur.com/i4MLMKz

Will I need to do this in JavaScript?

It's really just two steps. Detect if the browser window is active. That question was asked and answered here: Is there a way to detect if a browser window is not currently active? . Then you can just set the document.title property.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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