0

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.

leoken
  • 11
  • 1
  • 2
  • 1
    see this question: http://stackoverflow.com/questions/3514784/what-is-the-best-way-to-detect-a-handheld-device-in-jquery – keune Jul 24 '14 at 18:02
  • Actually, I found the perfect solution here: https://stackoverflow.com/questions/19645655/disable-skrollr-for-mobile-device-767px?rq=1 $(function () { if ($(window).width() > 767) { skrollr.init(); } $(window).on('resize', function () { if ($(window).width() <= 767) { skrollr.init().destroy(); } else { skrollr.init(); } }); }); Thank you to [iCoder](https://stackoverflow.com/users/3646748/icoder) for a clean, simple solution. – leoken Jul 24 '14 at 18:30

0 Answers0