我的代码是......
$(document).on("click", ".mp-likedImgs", function () {
var mplike= $(this).parent().parent().children().first().attr('id');
if (jQuery.inArray(mplike, unlikedImgsId) != -1) {
var delmpLike = unlikedImgsId.indexOf(mplike);
unlikedImgsId.splice(delmpLike, 1);
}
if (jQuery.inArray(mplike, likedImgsId) == -1) {
likedImgsId.push(mplike);
$(this).find('img').css({'opacity':'1.0'});
}
});
//start code for multiple image unlike button
$(document).on("click", ".mp-unlikedImgs", function () {
var mpunlike= $(this).parent().parent().children().first().attr('id');
if (jQuery.inArray(mpunlike, likedImgsId) != -1) {
var delmpUnLike= likedImgsId.indexOf(mpunlike);
likedImgsId.splice(delmpUnLike,1);
}
if (jQuery.inArray(mpunlike, unlikedImgsId) == -1) {
unlikedImgsId.push(mpunlike);
$(this).find('img').css({'opacity':'1.0'});
}
});
在全屏模式下,我喜欢&不像图像上的按钮。当我按下像,不像在图像上点击和&突出显示,但我想只为一个图像点击一个按钮,无论是喜欢还是不同。
提前谢谢......
答案 0 :(得分:0)
尝试使用同时具有类型的mp-UniqueImgs
类。
$(document).on("click", ".mp-UniqueImgs", function () {
我认为您正在使用相同的功能。更好地使用一个独特的类名,而不是现在,并将该操作应用于该新类。