【发布时间】:2015-10-17 23:09:42
【问题描述】:
我的一个 JS 遇到了一个小问题,如果你们能快速浏览一下并给我反馈,那就太好了。 在我的网站上,我有一个 JS,它模拟在图像上选择复选框。 http://cormilu.com.br/loja/monte-seu-kit/monte-seu-fio-de-luz/
当用户选择一个复选框时,该字符串将填充该颜色的球(活动)。当用户取消选中复选框时,它应该再次带走球(停用)。
colorDeactive函数定义如下:
function colorDeactive(_item) {
_item.removeClass('active');
_item.attr('data-timestamp', '');
_item.find('input[type="checkbox"]').prop('checked', false);
}
在此处处理激活和停用字符串上的球: // 绑定 $('#input_59_13 > li').find('input[type="checkbox"]').on('click', function(e){ var _this = $(this);
// check if this item is already actived
if(_this.hasClass('active'))
colorDeactive(_this);
else
colorActive(_this);
console.log('cor');
refreshPreview();
});
它曾经工作得很好,但不知何故现在它不再工作了(不修改脚本)。 谢谢你的帮助! 干杯
【问题讨论】:
标签: javascript wordpress