Jquery在火狐和IE上不起作用,无法在链接点击时执行操作



我有一个页面在Chrome上运行良好,但在IE或Firefox上却没有。我把这个Jsfiddle放在一起,它显示了部分问题:https://fiddle.jshell.net/dkwsswdw/2/

如果您在Chrome上打开它,您应该能够单击窗口顶部的向下箭头,然后从div向下滚动到div。如果你在Firefox或IE中打开它,它会停止工作。

有什么想法吗?我知道在FF和IE中存在无法正确调用jQuery的问题,但我不确定它如何适用于此问题。(我已经广泛地研究了这个问题,我对jQuery来说太新了,无法弄清楚它是如何应用的。

注意:

如果有帮助,这是我在 Wordpress 中运行的实际循环,用于显示帖子并将"当前"类添加到循环中的第一篇文章中:

<?php
        // The Arguments
        $args = array(
            'post_type' => 'strange',
            'posts_per_page' =>-1, 
            'order_by' => 'menu_order'
        );
        $c = 0; 
        $class = ''; 
        // The Query
        $the_query = new WP_Query( $args ); ?>
        <?php
        // If we have the posts...
        if ( $the_query->have_posts() ) : ?>
        <!-- Start the loop the loop --> 
            <?php while ( $the_query->have_posts() ) : $the_query->the_post(); 
            $c++; 
            if ( $c == 1 ) $class .= ' current'; // if the item is the first item, add class current
            else $class = ''; 
            ?>
                <div id="strange-container" class="strange-container <?php echo $class; ?>">    
                    <img src="<?php the_field('strange-img'); ?>" alt="<?php the_title(); ?>" />
                    <span><?php the_field('strange-text'); ?></span>
                </div>
            <?php endwhile; endif; ?>
        <?php wp_reset_postdata(); ?>

仅供参考,您的图像位于htpasswd后面。

也就是说,一些浏览器喜欢在body上制作动画,而另一些浏览器则喜欢在html上制作动画。 更改如下所示的行:

$('body').animate({

对此:

$('html,body').animate({

最新更新