【问题标题】:JS/jQuery code works in chrome but not IE/FFJS/jQuery 代码在 chrome 中有效,但在 IE/FF 中无效
【发布时间】:2013-10-30 02:27:06
【问题描述】:

我只编写了几个月的代码,我正在努力弄清楚为什么这个 JS/jQuery 不能在我一直试图创建的简单网站上运行。我使用的是 Adob​​e Brackets,而实时预览使用的是 Chrome。一切都在 Chrome 中运行顺利,但是当我用 IE/FF JS/jQuery 打开索引文件时根本没有运行。

代码如下:

<script src="//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js">      </script>
<script src="modernizr.custom.55043.js"></script>
<script type="text/javascript">


function testimonialcontainer() {
    $(".testimonialcontainer #1").show("fade", 500);
    $(".testimonialcontainer #1").delay(5500).hide("slide", {direction: 'left'}, 500);

    var sc=$(".testimonialcontainer img").size();
    var 
    count=2;

setInterval(function() {
        $(".testimonialcontainer #" + count).show("slide", {direction: 'right'}, 500);
        $(".testimonialcontainer #" + count).delay(5500).hide("slide", {direction:'left'}, 500);

if(count == sc) {
    count = 1;
   } else {
count = count + 1;
}
}, 6500);


};
</script>

HTML

<div class="testimonialcontainer">  
<img src="testimonials/test1.png" id="1" />
<img src="testimonials/test2.png" id="2" />
<img src="testimonials/test3.png" id="3" />
</div>

CSS

.testimonialcontainer {
    width: 795px;
    height:175px;
    position: absolute;
    margin-top: 1000px;
    margin-left: 102px;
    border-top: 4px solid black;
    border-bottom: 2px dotted black;
}

.testimonialcontainer img {
    width: 756px;
    height: 155px;
    display: none;
    padding: 10px;
}

提前致谢!

没有

【问题讨论】:

  • 我认为您的脚本源需要 http(s) 前缀。 FF 将尝试将该 url 作为本地文件查找。
  • 嗯,这可能是句法上的。我现在正在查看您的代码,但您应该首先更改 .hide("fade", 500);只是淡出(500);
  • 另外,虽然 #1 在 Chrome 中用作 div 名称,但它不会在 IE/FF 中。

标签: javascript jquery debugging google-chrome firefox


【解决方案1】:

数字本身不能作为 IE/FF 中 div 的名称。

【讨论】:

    猜你喜欢
    • 2013-01-16
    • 1970-01-01
    • 2011-02-22
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-02-27
    • 2011-12-17
    • 2014-04-17
    相关资源
    最近更新 更多