競合するコードにいくつかの問題があります。コンソールでエラーをチェックしましたが、これまでのところ何もありません。基本的に、jGrowl を介した通知でいくつかの選択肢があります。
jQuery 1.9.1を使用しています
これは最初の部分です
$("#amconf-images-139.amconf-images-container").click(function() {
if ($('#amconf-image-84.amconf-image.amconf-image-selected').length){
var a = $('input[name="qty2"]').val().replace("$", "");
var b = $('#product-price-1202_clone span.price').html().replace("$", "");
$.jGrowl("1 inch Debossed Selected<br />Estimated Cost: $" + (a*b).toFixed(2));
} else if ($('#amconf-image-86.amconf-image.amconf-image-selected').length){
$.jGrowl("1 inch Ink-Injected Selected<br />Estimated Cost: $" + (a*b).toFixed(2));
} else if ($('#amconf-image-87.amconf-image.amconf-image-selected').length){
$.jGrowl("1 inch Printed Selected<br />Estimated Cost: $" + (a*b).toFixed(2));
}
});
上記のコードは機能しますが、2 番目の部分が強制終了されます
$("#amconf-images-140").click(function() {
if ($('#amconf-image-114.amconf-image.amconf-image-selected').length){
$.jGrowl("Black Color Selected");
} else if ($('#amconf-image-115.amconf-image.amconf-image-selected').length){
$.jGrowl("Brown Color Selected");
} else if ($('#amconf-image-116.amconf-image.amconf-image-selected').length){
$.jGrowl("Green Color Selected");
} else if ($('#amconf-image-117.amconf-image.amconf-image-selected').length){
$.jGrowl("Grey Color Selected");
} else if ($('#amconf-image-118.amconf-image.amconf-image-selected').length){
$.jGrowl("Hot Pink Color Selected");
} else if ($('#amconf-image-119.amconf-image.amconf-image-selected').length){
$.jGrowl("Hunter Green Color Selected");
} else if ($('#amconf-image-120.amconf-image.amconf-image-selected').length){
$.jGrowl("Lavender Color Selected");
} else if ($('#amconf-image-121.amconf-image.amconf-image-selected').length){
$.jGrowl("Light Blue Color Selected");
} else if ($('#amconf-image-122.amconf-image.amconf-image-selected').length){
$.jGrowl("Light Pink Color Selected");
} else if ($('#amconf-image-123.amconf-image.amconf-image-selected').length){
$.jGrowl("Lime Green Color Selected");
} else if ($('#amconf-image-124.amconf-image.amconf-image-selected').length){
$.jGrowl("Maroon Color Selected");
} else if ($('#amconf-image-125.amconf-image.amconf-image-selected').length){
$.jGrowl("Metallic Gold Color Selected");
} else if ($('#amconf-image-126.amconf-image.amconf-image-selected').length){
$.jGrowl("Metallic Silver Color Selected");
} else if ($('#amconf-image-127.amconf-image.amconf-image-selected').length){
$.jGrowl("Olive Green Color Selected");
} else if ($('#amconf-image-128.amconf-image.amconf-image-selected').length){
$.jGrowl("Orange Color Selected");
} else if ($('#amconf-image-129.amconf-image.amconf-image-selected').length){
$.jGrowl("Pearl Blue Color Selected");
} else if ($('#amconf-image-130.amconf-image.amconf-image-selected').length){
$.jGrowl("Purple Color Selected");
} else if ($('#amconf-image-131.amconf-image.amconf-image-selected').length){
$.jGrowl("Red Color Selected");
} else if ($('#amconf-image-132.amconf-image.amconf-image-selected').length){
$.jGrowl("Reflex Blue Color Selected");
} else if ($('#amconf-image-133.amconf-image.amconf-image-selected').length){
$.jGrowl("Teal Color Selected");
} else if ($('#amconf-image-134.amconf-image.amconf-image-selected').length){
$.jGrowl("White Color Selected");
} else if ($('#amconf-image-135.amconf-image.amconf-image-selected').length){
$.jGrowl("Yellow Color Selected");
} else if ($('#amconf-image-136.amconf-image.amconf-image-selected').length){
$.jGrowl("Yellow Gold Color Selected");
}
});
2番目のjquery部分は通知を表示したくないのですが、divがあまりにも似ている可能性がありますか? それらは、独自の一意の番号を持つ完全に独立した div です。
何か案は?