I'm trying to load a custom javascript for cloudzoom on desktops and a other one for touch devices.
In my i have this piece of code:
if ("ontouchstart" in document.documentElement){
// It's a touch screen device.
$.getScript('/js/cloud-zoom.1.0.2.min.js'),
$(function() {
alert('iPad Load was performed.');
});
}
else {
$.getScript('/js/cloud-zoom.1.0.2.custom.js'),
$(function() {
alert('Custom Load was performed.');
});
}
This works fine. But when i remove the alert the script will not load... I don't get a error in the console of firefox either. How can i make it work without alerting something.