我正嘗試在臺式機和另一臺觸摸設備上加載cloudzoom的自定義JavaScript。
在我,我有這段代碼:
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.');
});
}
這工作得很好。但是,當我刪除警報的腳本將不會加載...我也沒有在Firefox的控制檯中的錯誤。我怎樣才能讓它工作而不提醒某事。
你只除去警報?或者整個回調部分? –