简体   繁体   中英

JS/jQuery code works in chrome but not IE/FF

I've only been coding a couple of months and I'm struggling to figure out why this JS/jQuery wont run on a simple website I've been trying to create. I'm using Adobe Brackets and the live preview uses Chrome. Everything runs smoothly in Chrome, but when I open the index file with IE/FF JS/jQuery doesn't run at all.

Code as follows:

<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;
}

Thanks in advance!

N

单独的数字不能用作IE / FF中div的名称。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM