我有图片,点击它会显示jquery模式,其内容是轮播。
当我直接运行代码时,我的代码可以工作(例如file:///C:/New%20folder/htdocs/IINO/events.html
)但是当我使用我的本地服务器访问它时它不起作用(例如http://localhost/iino/events.html
)它只显示特殊的一组字符。
Special Character Error
$(document).ready(function(){
var parade = ['img/Parade/1.jpg', 'img/Parade/2.jpg', 'img/Parade/3.jpg', 'img/Parade/4.jpg','img/Parade/5.jpg','img/Parade/6.jpg'];
var Day1AM = ['img/Day1AM/4.jpg', 'img/Day1AM/2.jpg', 'img/Day1AM/3.jpg', 'img/Day1AM/1.jpg', 'img/Day1AM/5.jpg', 'img/Day1AM/6.jpg'];
var Day1PM = ['img/Day1PM/1.jpg','img/Day1PM/2.jpg','img/Day1PM/3.jpg','img/Day1PM/4.jpg','img/Day1PM/5.jpg','img/Day1PM/6.jpg']
var Day2C = ['img/Day2C/1.jpg','img/Day2C/2.jpg','img/Day2C/3.jpg','img/Day2C/4.jpg','img/Day2C/5.jpg','img/Day2C/6.jpg',]
var Day2Socio = ['img/Day2Socio/1.jpg','img/Day2Socio/2.jpg','img/Day2Socio/3.jpg','img/Day2Socio/4.jpg','img/Day2Socio/5.jpg','img/Day2Socio/6.jpg',]
var Day2Award = ['img/Day2Award/1.jpg','img/Day2Award/2.jpg','img/Day2Award/3.jpg','img/Day2Award/4.jpg','img/Day2Award/5.jpg','img/Day2Award/6.jpg',]
var Day3 = ['img/Day3/1.jpg','img/Day3/2.jpg','img/Day3/3.jpg','img/Day3/4.jpg','img/Day3/5.jpg','img/Day3/6.jpg',]
var id;
$('.thumbnail').click(function(){
var i = 0;
id = $(this).attr('id');
if (id == "parade") {
var imgsrc = parade.slice();
} else if(id == "Day1AM") {
var imgsrc = Day1AM.slice();
}
else if(id == "Day1PM") {
var imgsrc = Day1PM.slice();
}
else if (id == "Day2C"){
var imgsrc = Day2C.slice();
}
else if (id == "Day2Socio"){
var imgsrc = Day2Socio.slice();
}
else if (id == "Day2Award" ){
var imgsrc = Day2Award.slice();
}
else if (id == "Day3") {
var imgsrc = Day3.slice();
}
$('.modal-body img').each(function(){
$(this).attr('src', imgsrc[i]);
i++;
});
});
});