Trying to load stylesheet only for touch devices with Modernizr

inanvadly

New Member
I've heard that Modernizr's test for touch is one of the best ways to test if the device a page is being viewed on is touch or multi-touch enabled.I'm trying to use it ( the touch test ) as well as modernizr's load function to load a stylesheet only when the device has touch capability.However, my code doesn't seem to be working. What am I doing wrong?\[code\]<script type="text/javascript">Modernizr.load({ test: Modernizr.touch, yep: 'assets/css/touch.css'});</script>\[/code\]Update: Sorry, I should have clarified what not-working means:When I visit the page on my multi-touch smart-phone, the styles are not taking effect.I applied the styles in the normal stylesheet and they take effect, but when I switch them into touch.css and try to load that conditionally with Modernizr, it doesn't work.My copy of Modernizr does include yepnope and the touch test as I am using both in other instances where they are working.
 
Back
Top