Javascript代码在谷歌浏览器上工作正常但不适用于Mozilla Firefox

时间:2016-02-28 09:19:40

标签: javascript jquery html

我的网站上有一个滑块,但它在谷歌浏览器上工作正常但不适用于mozilla firefox。请帮我解决这个问题。

javascript代码:

<script type="text/javascript">
    $(document).ready(function() {

        var currentPosition = 0;
        var slideWidth = 230;
        var slides = $('.clienttestslide');
        var numberOfSlides = slides.length;
        var slideShowInterval;
        var speed = 3000;


        slideShowInterval = setInterval(changePosition, speed);

        slides.wrapAll('<div id="clienttestslideHolder"></div>')

        slides.css({ 'float' : 'left' });

        $('#clienttestslideHolder').css('width', slideWidth * numberOfSlides);


        function changePosition() {
            if(currentPosition == numberOfSlides - 1) {
                currentPosition = 0;
            } else {
                currentPosition++;
            }
            moveSlide();
        }


        function moveSlide() {
                $('#clienttestslideHolder')
                  .animate({'marginLeft' : slideWidth*(-currentPosition)});
        }

    });
</script>  

html代码:

<div id="clienttest">
                 <div id="clienttestwindow">
                        <div class="clienttestslide">
                            <div class="statementup">
                                <div class="statementdown">
                                    <p>I recently booked a tour with 
Green Apple Travel around Kathmandu. This is the second time I use their 
services.
I have traveled worldwide for the last 50 years and have been in 
business with dozens of t...   </p>
                               </div>
                           </div>



                           <div class="anno_textarea_text">
                               <p style="margin-left:20px; color:#e30715;"><strong>Client Name</strong></p>

                           </div>

                        </div>


                        <div class="clienttest">
                           <div class="statementup">
                                <div class="statementdown">
                                    <p>I recently booked a tour with 
Green Apple Travel around Kathmandu. This is the second time I use their 
services.
I have traveled worldwide for the last 50 years and have been in 
business with dozens of t...   </p>
                               </div>
                           </div>




                           <div class="anno_textarea_text">
                               <p style="margin-left:20px; color:#e30715;"><strong>Client Name</strong></p>

                           </div>
                        </div>


                        <div class="clienttestslide">
                          <div class="statementup">
                                <div class="statementdown">
                                    <p>I recently booked a tour with 
Green Apple Travel around Kathmandu. This is the second time I use their 
services.
I have traveled worldwide for the last 50 years and have been in 
business with dozens of t...   </p>
                               </div>
                           </div>




                           <div class="anno_textarea_text">
                               <p style="margin-left:20px; color:#e30715;"><strong>Client Name</strong></p>

                           </div>
                        </div>
                        </div>
                     </div>

Slider在chrome上工作得很好但是当我在mozilla firefox上测试时它没有工作并显示空白。我希望有人可以提供帮助。先感谢您。

0 个答案:

没有答案