1) How to get an alert when I select 1_1.jpg, 1_2.jpg, 1_3.jpg or 2_1.jpg, 2_2.jpg, 2_3.jpg and the other ones arn't selected? (something like this *_1.jpg, *_2.jpg, *_3.jpg)
2) How to randomly position the order of the images (ex: first one: 2_1.jpg, second: 1_5, third:1_9 etc. so only the end of src (_.jpg) should differe)?
http://jsfiddle.net/alecstheone/br4bS/
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");
});