// It will add the appropriate class to node var root = document.documentElement; if(('ontouchstart' in window) || window.DocumentTouch && document instanceof DocumentTouch) { root.className += ' touch'; } else { root.className += ' no-touch'; }