我有一个页面在 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({
关于javascript - Jquery 无法在 Firefox 和 IE 上执行链接点击操作,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43240384/