jQuery - detect for touch only device

If your website includes features that only available to devices with a touch screen , you not need to use external Modernizr libraries only use function below
   <script type="text/javascript">
        $(document).ready(function () {
            if (is_touch_device()) {
                // do something
            }    
        });

        function is_touch_device() {
            return !!('ontouchstart' in window);
        }
    </script>