【发布时间】:2019-10-11 06:26:46
【问题描述】:
我通常尝试做的是,检测来自 Trustpilot 小部件的产品是否有 0 条评论,如果是,则显示来自 Trustpilot 的另一个小部件,以显示我们服务的评论数量。
现在,当在页面上找到一个名为“tp-stars--0”的 div 类时,我一直在尝试隐藏小部件。
这是我目前得到的结果
$('.trustpilot-widget' ).ready(function() {
if($('.tp-widget-stars').find('.tp-stars.tp-stars--0').length) {
$('#tp-widget-wrapper').removeClass('visible');
}
});
<div id="tp-widget-wrapper" class="tp-widget-wrapper visible">
<div id="wrapper-company-stars" class="wrapper-company-stars">
<!-- Stars -->
<div id="tp-widget-stars" class="tp-widget-stars">
<div class="">
<div class="tp-stars tp-stars--0">
<div style="position: relative; height: 0; width: 100%;
padding: 0; padding-bottom: 18.326693227091635%;">
</div>
</div>
</div>
</div>
<div class="tp-widget-readmore" id="numberOfReviews"><strong>No
reviews</strong>
</div>
</div>
</div>
【问题讨论】:
标签: jquery shopify trustpilot