简体   繁体   中英

Jquery not working Firefox and IE for action executed on link click

I have a page that's functioning well on Chrome, but not on IE or Firefox. I put together this Jsfiddle which shows part of the issue: https://fiddle.jshell.net/dkwsswdw/2/

If you open it on Chrome, you should be able to click on the down arrow at the top of the window and scroll down from div to div. If you open it in Firefox or IE, it stops working.

Any ideas? I understand that there are issues with jQuery not getting called properly in FF and IE, but I'm not sure how it applies to this issue. (I've looked at this extensively and I'm just too new to jQuery to figure out exactly how this applies.)

Note:

If it's helpful, here's the actual loop that I'm running in Wordpress to display the posts and add the 'current' class to the first post in the loop:

<?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(); ?>

FYI, your images are are behind an htpasswd .

That said, some browsers like to animate on body while others like to animate on html . Change your line that looks like this:

$('body').animate({

to this:

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

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