1) Is there a way to trigger an alert only when images like 1_1.jpg, 1_2.jpg, 1_3.jpg or 2_1.jpg, 2_2.jpg, 2_3.jpg are selected and none of the others? (similar to *_1.jpg, *_2.jpg, *_3.jpg)
2) How can I shuffle the order of the image positions randomly (e.g. first: 2_1.jpg, second: 1_5.jpg, third: 1_9.jpg etc., where only the end of src (_*.jpg) should differ)?
HTML:
<img class="image" src="../img/Album1/1_1.jpg">
<img class="image" src="../img/Album1/1_2.jpg">
<img class="image" src="../img/Album1/1_3.jpg">
<img class="image" src="../img/Album1/1_4.jpg">
<img class="image" src="../img/Album1/1_5.jpg">
<img class="image" src="../img/Album1/1_6.jpg">
<img class="image" src="../img/Album1/1_7.jpg">
<img class="image" src="../img/Album1/1_8.jpg">
<img class="image" src="../img/Album1/1_9.jpg">
<img class="image" src="../img/Album1/1_10.jpg">
<img class="image" src="../img/Album1/2_1.jpg">
<img class="image" src="../img/Album1/2_2.jpg">
<img class="image" src="../img/Album1/2_3.jpg">
CSS:
.img {
height:30px;
width:30px;
background:blue;
margin-left:10px;
}
.selected {
-moz-box-shadow: 0 0 7px 4px blue;
-webkit-box-shadow: 0 0 7px 4px blue;
box-shadow: 0 0 7px 4px blue;
}
JQUERY:
$( ".image" ).click(function() {
if($(this).hasClass("selected"))
$(this).removeClass("selected");
else
$(this).addClass("selected");
});