【发布时间】:2017-08-31 14:39:26
【问题描述】:
我的页面在 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(); ?>
【问题讨论】:
-
也根据我在 Stackoverflow 上的另一个线程中看到的内容进行了尝试:fiddle.jshell.net/dkwsswdw/19
标签: javascript php jquery html cross-browser