画像を選択するには、画像ピッカーのプラグインを使用しています。 https://rvera.github.io/image-picker/すべての画像を選択した場合 - 画像ピッカープラグインjQuery
私は小さな質問があります。どのように私は何かをするよりも選択されたすべての画像idを言う文を書くことができます。
送信ボタンがあります。すべての画像が選択されている場合は、ボタンを表示するか、そうでない場合は非表示にします。
HTML
<select class="image-picker" multiple="multiple" id="freestanding-sings-selection" name="freestanding-sings-selection" >
<option class="process-icons" data-img-src='../../css/freestanding-signs/insert-fts.png' value="1" id="insert">
</option>
<option class="process-icons insert_cover" data-img-src="../../css/freestanding-signs/cover-fts.png" value="2">
</option>
<option class="" data-img-src="../../css/freestanding-signs/label.png" value="3">
</option>
</select>
はJavaScript
$("#freestanding-sings-selection").imagepicker({
//if all images slected {
//do something
//}
});
ありがとう
編集セルフチェック
を作りました$("#freestanding-sings-selection").imagepicker({
selected: function(selected) {
if (selected.length >= 3) {
alert(3);
}
}
});
これは機能しますが、機能を実行するよりもすべての画像が選択されているとします。上記のコードは、画像をクリックするたびに機能を起動します。 –
"limit_reached"コールバックを使用します。制限を2に設定して2を選択した場合は、コールバックが発生します –
limit_reachedを試しました。私は3つの画像を持っています。ユーザーは3つの画像を選択することができません。私は限界を3に設定すると、4番目の画像があり、ユーザーが4番目の画像をクリックするとトリガーされるため、何もトリガーされません。 –