在重定向模式下自动滚动到产品顶部
在您当前WordPress主题的footer.php文件中(使用子主题),添加以下代码:
<?php if (isset($_GET['swoof'])): ?>
<script>
jQuery(function ($) {
setTimeout(function () {
$('html, body').animate({
scrollTop: $(".woof_products_top_panel_content").offset().top - 100
}, 777);
}, 333);
});
</script>
<?php endif; ?>
.woof_products_top_panel_content – 是滚动结束位置的容器CSS类。您可以使用任何带有任意CSS类或id的容器 …