yoone-wc-subscriptions/assets/js/frontend.js

16 lines
592 B
JavaScript
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

/**
* 前端 JS订阅选项的轻量交互
* - 当用户切换“一次性购买/订阅购买”时,为容器添加/移除样式钩子,便于样式控制
*/
(function($){
// 切换一次性购买/订阅购买时,简单控制 UI可按需扩展隐藏/显示订阅字段)。
$(document).on('change', 'input[name="yoone_sub_purchase_mode"]', function(){
var mode = $(this).val();
var box = $('.yoone-subs-block');
if (mode === 'onetime') {
box.addClass('yoone-subs-onetime');
} else {
box.removeClass('yoone-subs-onetime');
}
});
})(jQuery);