My code is very long. I can not show you all here. I just show the javascript code only
My javascript like this :
Sorry, I was misunderstand.
Mayby you need a judgement after you delete an image that make sure the next image is not show.
$('#thumbnail-view-delete-'+i).click(function(){
$('input[name="photo-'+i+'"]').val('');
document.getElementById("thumbnail-view-li-"+i).style.display = "none";
document.getElementById("thumbnail-upload-li-"+i).style.display = "";
if(document.getElementById("thumbnail-view-li-"+(i+1)).style.display === "none"){
document.getElementById("thumbnail-upload-li-"+(i+1)).style.display = "none";
document.getElementById("thumbnail-slot-li-"+(i+1)).style.display = "";
}
});
This can descrease the messy.