Php WooCommerce评论的锚链接

Php WooCommerce评论的锚链接,php,jquery,html,wordpress,woocommerce,Php,Jquery,Html,Wordpress,Woocommerce,向下滚动到“Woocommerce评论选项卡”的锚链接工作不正常 <div class="woocommerce-product-rating"> <?php echo wc_get_rating_html( $average, $rating_count ); ?> <?php if ( comments_open() ) : ?><a href="#tab-reviews" class="woocommerce-rev

向下滚动到“Woocommerce评论选项卡”的锚链接工作不正常

<div class="woocommerce-product-rating">
        <?php echo wc_get_rating_html( $average, $rating_count ); ?>
        <?php if ( comments_open() ) : ?><a href="#tab-reviews" class="woocommerce-review-link" rel="nofollow">(<?php printf( _n( '%s customer review', '%s customer reviews', $review_count, 'woocommerce' ), '<span class="count">' . esc_html( $review_count ) . '</span>' ); ?>)</a><?php endif ?>
    </div>

我已经检查了链接是否显示了正确的锚点,即
这是因为review div被隐藏了。如果您先单击review选项卡,然后单击链接,它将起作用

我认为您需要链接到id为“tab title reviews”的review选项卡


jQuery('.woocommerce审阅链接')。单击(函数(){
jQuery(“#选项卡标题检查a”).trigger('click');
});

这是因为review div是隐藏的。如果您先单击review选项卡,然后单击链接,它将起作用

我认为您需要链接到id为“tab title reviews”的review选项卡


jQuery('.woocommerce审阅链接')。单击(函数(){
jQuery(“#选项卡标题检查a”).trigger('click');
});

此更改会使其滚动,但不会打开“评论”选项卡-它会打开“说明”选项卡?我告诉过你需要自定义js代码来实现此更改会使其滚动,但不会打开“评论”选项卡-它会打开“说明”选项卡?我告诉过你需要自定义js代码来实现此目的
<div class="woocommerce-product-rating">
        <?php echo wc_get_rating_html( $average, $rating_count ); ?>
        <?php if ( comments_open() ) : ?><a href="#tab-title-reviews" class="woocommerce-review-link" rel="nofollow">(<?php printf( _n( '%s customer review', '%s customer reviews', $review_count, 'woocommerce' ), '<span class="count">' . esc_html( $review_count ) . '</span>' ); ?>)</a><?php endif ?>
    </div>
<script>
jQuery('.woocommerce-review-link').click(function(){
    jQuery('#tab-title-reviews a').trigger('click');
});
</script>