Created
June 5, 2014 17:05
-
-
Save stevekinney/3c6293ea4111fb09b699 to your computer and use it in GitHub Desktop.
Set to Top-Most Element Based on Time
This file contains 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
$(this).css('z-index', parseInt((+new Date()).toString().slice(6), 10)); | |
/* | |
Uses the system time to set the current element's z-index above other elements | |
on the page. This terrible hack allows me to not have to store the most recent | |
z-index anywhere. I can't wait to see how it bites me. | |
Context: I use it with draggables in jQuery UI. | |
You could set it to `.slice(3) if you don't care about Safari 3 support, | |
but it really shouldn't matter. | |
Browser Max z-index value When exceeded, value changes to: | |
Internet Explorer 6 2147483647 2147483647 | |
Internet Explorer 7 2147483647 2147483647 | |
Internet Explorer 8 2147483647 2147483647 | |
Firefox 2 2147483647 *element disappears* | |
Firefox 3 2147483647 0 | |
Safari 3 16777271 16777271 | |
Safari 4 2147483647 2147483647 | |
Chrome 29 2147483647 2147483647 | |
Opera 9 2147483647 2147483647 | |
Source: http://stackoverflow.com/questions/8565821/css-max-z-index-value | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment