Created
October 11, 2018 15:38
-
-
Save lawebfabric/7871bd26ff30082b765ce4246a0d23a6 to your computer and use it in GitHub Desktop.
Jquery function to change browser tab title when browser tab is not active
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jQuery(document).ready(function( $ ){ | |
// Get page title | |
var pageTitle = $("title").text(); | |
// Change page title on blur | |
$(window).on('blur', function() { | |
$("title").text('💔 Vous nous manquez !'); | |
}); | |
// Change page title back on focus | |
$(window).on('focus', function() { | |
$("title").text(pageTitle); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment