我的页面上有一个滑动轮播,当我在IE中访问页面时,它无法正常工作,而是以列表格式显示了应该在轮播中的图像,好像我的浏览器没有阅读选择器的javascript并应用了效果。
到目前为止,这仅发生在IE7 / 8中,当我在Firebug中查看源代码时,好像我的脚本标签已被浏览器关闭,才有机会看到jQuery。
但是,如果我在jQuery之前添加JS警报,则会弹出警报,然后加载jquery,这样我的轮播就可以工作了。
<script type="text/javascript">
//This works with an alert, without it the browser renders <script type="text/javascript" />
alert('test');
$(document).ready(function() {
$('#seasonaloffers').carousel({
start: 1
});
$('#newproducts').carousel({
start: 1
});
});
</script>
最佳答案
三件事:
验证您的html-http://validator.w3.org/
检查您是否没有错误地重复#id
使用strict / html5文档类型-http://ejohn.org/blog/html5-doctype/
关于javascript - IE 7/8中的奇怪Javascript怪癖,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/8507622/