kmkmediagroup
asked on
jquery if else statement for ipad and smooth-div-scroll plugin
Hello,
I am using the jquery smooth-div-scroll plugin and it works on ipad with one set of plugin initialization options and works on a windows tablet with a different set of initialization options. (the windows tablet setting also works for everything else)
So, I am trying to use a jquery if/else to basically say,
If user is ipad then do this-
use these plugin options:
touchScrolling: true,
manualContinuousScrolling: false
else (otherwise use these options)-
hotSpotScrolling: true,
manualContinuousScrolling: false
Here's what I have so far but don't know how to correctly inject the else statement into this. Can someone please help with this part?
<script type="text/javascript">
$(document).ready(function () {
var browser = navigator.userAgent;
if (browser.match(/iPad/i)) {
}
$("div#ScrollContainer").s moothDivSc roll({
touchScrolling: true,
manualContinuousScrolling: false
});
});
</script>
I am using the jquery smooth-div-scroll plugin and it works on ipad with one set of plugin initialization options and works on a windows tablet with a different set of initialization options. (the windows tablet setting also works for everything else)
So, I am trying to use a jquery if/else to basically say,
If user is ipad then do this-
use these plugin options:
touchScrolling: true,
manualContinuousScrolling:
else (otherwise use these options)-
hotSpotScrolling: true,
manualContinuousScrolling:
Here's what I have so far but don't know how to correctly inject the else statement into this. Can someone please help with this part?
<script type="text/javascript">
$(document).ready(function
var browser = navigator.userAgent;
if (browser.match(/iPad/i)) {
}
$("div#ScrollContainer").s
touchScrolling: true,
manualContinuousScrolling:
});
});
</script>
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ooops, I take that back. It worked. Not sure why it didn't the first time - I think I just may have omitted the closing script tag or something, but is working now!
Thank you!!
Thank you!!
ASKER
Thanks for the super quick response!!
ASKER
But what I do know is that the result it is applying the first set of options to ALL - so seems to be ignoring the "else" part. Any ideas?