Created
September 26, 2016 05:52
-
-
Save ki11ua/d8182d081ec31d23a18e6c7ec6210ad9 to your computer and use it in GitHub Desktop.
current window height width state func
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
function isTouchDevice(){ | |
return true == ('ontouchstart' in window || window.DocumentTouch && document instanceof DocumentTouch); | |
} | |
function current() { | |
var state='click'; | |
if(isTouchDevice()===true) { | |
state='touchstart'; | |
} | |
return {h : Math.max(document.documentElement.clientHeight, window.innerHeight || 0), w: Math.max(document.documentElement.clientWidth, window.innerWidth || 0),scroll:(window.pageYOffset || document.documentElement.scrollTop) - (document.documentElement.clientTop || 0),state:state}; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment