Php 无法在WooCommerce中的移动版本上单击“自定义后退”按钮
在Woocommerce中,我有一个自定义的后退按钮,但当我在移动版本中单击它时,它就不起作用了 按钮链接到图像,但不返回功能 这是我的密码:Php 无法在WooCommerce中的移动版本上单击“自定义后退”按钮,php,jquery,wordpress,mobile,woocommerce,Php,Jquery,Wordpress,Mobile,Woocommerce,在Woocommerce中,我有一个自定义的后退按钮,但当我在移动版本中单击它时,它就不起作用了 按钮链接到图像,但不返回功能 这是我的密码: add_action( 'woocommerce_before_single_product_summary', 'woocommerce_before_single_product_summary_button', 5); function woocommerce_before_single_product_summary_button() {
add_action( 'woocommerce_before_single_product_summary', 'woocommerce_before_single_product_summary_button', 5);
function woocommerce_before_single_product_summary_button() {
echo ' <button class="backbutton" type="button" onclick="history.back();"> Back </button> ';
}
add_action('woocommerce_-before_-single_-product_-summary','woocommerce_-before_-single_-product_-summary_-button',5);
功能按钮(单个产品之前的商品汇总按钮){
回声“回来”;
}
它适用于桌面版,但不适用于移动版
如何使其在移动版和桌面版上工作?在您的挂钩功能中,我已将您的
替换为;
?>
(函数($){
$('a.back-button')。单击(函数(e){
e、 预防默认值();
历史。go(-1);
});
})(jQuery);
谢谢LoicTheAztec@AftabHusain你在iOS上测试过吗?
add_action( 'woocommerce_before_single_product_summary', 'woocommerce_before_single_product_summary_button', 5);
function woocommerce_before_single_product_summary_button() {
echo ' <a href="#" class="back-button button"> '. __('Back').' </a> ';
?>
<script>
(function($) {
$('a.back-button').click(function(e){
e.preventDefault();
history.go(-1);
});
})(jQuery);
</script>
<?php
}