First step -
I am appending number of <img>
tag in to specific div [Adding depends window width] see code here
function imgAdding() {
for (var i = 0; i < ($(window).width()/100) -1 ; i++) {
var $wrap = $('<img src="" width="100px" alt="" />');
$('.img-wrap').append($wrap);
}
}
Second step-
Then adding different src path on each img tag [ ex: pic-1.gif , pic-2.gif , pic-3.gif ]
//img name adding
function hexImgName () {
var count = 0;
$("img").each(function(i) {
var imgSRC = 'img/hex/pic-'+(count)+'.gif'
$(this).attr('src',imgSRC );
count = parseInt (count) + 1
});
}
Working fine last two steps
my problem here
Third step -I have only ten images in my img folder [pic-1.gif , pic-2.gif , .... last pic pic-10.gif ] , If there 15 img tag in html so last 5 img src path should fail -
my question
How can i find failed Image Error path via jQuery ? How can i randomly assign different src paths to our error images ?
Working area
Demo on full page
Thanks Friends