I know this is a simple one but, I'm just not good enough with JavaScript to get it right.
I have a script I'm using (skrollr.js) to create some animated parts and I do not want this script to run when the site is hit on a mobile device.
The script is simply:
<script type="text/javascript" src="/scripts/skrollr.min.js"></script>
<script type="text/javascript">
var s = skrollr.init();
</script>
It works great on desktop but is funky on mobile devices so, I've decided to just disable it all together on mobile.
I don;t want to redirect to a different page or anything... I simply just don;t want the script to run on mobile. How can I make that happen?
Thanks.
Detecting a mobile browser Please check this post. just put your script you want to run in the if statement.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.