android - disable css animation on mobile devices -
i working on horizontal scrolling site , add it has couple of css animations totally crash browsers on ipad testing on, wondering if there way code detect mobile devices (ios, android..) on , above screen sizes, disable animation it?
thanks in advance.
i haven't attached code because, not know use detect os, aware of using media queries said window size not looking mobile os want target.
you can use navigator.platform
property check device type, use javascript add stylesheet containing css animations if it's not 1 of excluded platforms.
for example, load animations devices besides ipads, do:
if(navigator.platform != 'ipad') { var link = document.createelement('link'); link.rel = 'stylesheet'; link.type = 'text/css'; link.href = 'animations.css'; document.getelementsbytagname('head')[0].appendchild(link); }
for list of platform values, refer here:
what list of possible values navigator.platform of today?
for more info on loading stylesheet js, here:
how load css files using javascript?
Comments
Post a Comment