Posted 2 November 2020, 6:14 am EST
Hi,
I have started to have issues with the carousel. Basically when they end user uploads photos it adds them to the carousel but now and then it does show them all. Below is my code snippet:-
$.ajax({
type: “POST”,
url: “CICMaint.aspx/ShowPhotos”,
data: “{‘CICRefNo’:'” + CICRefNo + “'}”,
contentType: “application/json; charset=utf-8”,
dataType: “json”,
async: false,
cache: false,
success: function (response) {
var htmlstr = “”;
//Clear Carousel Down
$(“.wijmo-wijcarousel-item”).each(function (e, args) {
$(this).remove();
});
$(“#Carousel”).c1carousel(“refresh”);
if (response.d.length >= 1) {
for (var photocount = 0; photocount <= response.d.length - 1; photocount++) {
htmlstr = “
$(“#Carousel”).c1carousel(“add”, htmlstr, photocount);
}
$(“#Carousel”).c1carousel(“refresh”);
$(“#Carousel”).c1carousel(“scrollTo”, PhotoSequenceNo);
$(“#Carousel”).c1carousel({
itemClick: function (e, data) {
CarouselPhotoIndex = data.index;
}
});
$(“.wijmo-wijcarousel-item a”).click(function (e) {
e.preventDefault(); //Avoids opening of image in a new page
PhotoRefNo = $(this).parents(‘li’).children(‘span’).text();
LoadPhoto(PhotoRefNo);
});
LoadPhoto(response.d[PhotoSequenceNo].PhotoRefNo);
if ($(“input[id*=‘inpSiteActivated’]”).val() !== “0”) { //Site activated
if ($(“#cboStatus”).val() == 0) { //CIC in Draft.
PhotoButtonState(‘enabled’, false, false, false);
} else {
PhotoButtonState(‘disabled’, true, true, true);
}
} else {
PhotoButtonState(‘enabled’, false, false, false);
}
} else {
if ($(“input[id*=‘inpSiteActivated’]”).val() !== “0”) { //Site Activated.
if ($(“#cboStatus”).val() == 0) { //CIC in Draft.
PhotoButtonState(‘disabled’, true, false, true);
} else {
PhotoButtonState(‘disabled’, true, true, true);
}
} else {
PhotoButtonState(‘disabled’, true, false, false);
}
Initialise_Photo();
ResetBlobs(1);
}
$(“input[id*=‘inpShowPhotos’]”).val(‘0’);
},
error: function (xhr, status, error) {
alert("AJAX Error (LoadPhotos): " + xhr.responseText);
}
});
If you exit the browser and go back in it shows it.
Many Thanks,