let obj = [{
"pageID": "93",
"page_type_id": "2",
"display_id": "2",
"duration": "74",
"background_img": "images\/bg_rainbow.svg",
"panel_id": "86",
"panel_type_id": "2",
"cont_id": "138",
"contID": "138",
"content": "\r\n\r\n\r\n<\/head>\r\n\r\nLeft 93<\/p>\r\n<\/body>\r\n<\/html>"
},
{
"pageID": "93",
"page_type_id": "2",
"display_id": "2",
"slide_order": null,
"duration": "74",
"background_img": "images\/bg_rainbow.svg",
"panel_id": "87",
"panel_type_id": "3",
"cont_id": "139",
"contID": "139",
"content": "\r\n\r\n\r\n<\/head>\r\n\r\nRight 93<\/p>\r\n<\/body>\r\n<\/html>"
},
{
"pageID": "94",
"page_type_id": "2",
"display_id": "2",
"slide_order": null,
"duration": "75",
"background_img": "images\/bg_rainbow.svg",
"panel_id": "88",
"panel_type_id": "3",
"cont_id": "140",
"contID": "140",
"content": "\r\n\r\n\r\n<\/head>\r\n\r\nRight New<\/p>\r\n<\/body>\r\n<\/html>"
}
];
let counter = 0;
var fullContent = document.getElementById('fullContent');
var leftContent = document.getElementById('leftContent');
var rightContent = document.getElementById('rightContent');
var fullColumn = document.getElementById('fullColumn');
var leftColumn = document.getElementById('leftColumn');
var rightColumn = document.getElementById('rightColumn');
setInterval(() => {
const currentJSONobject = obj[counter];
if (currentJSONobject.page_type_id == 1) {
leftColumn.style.display = "none";
rightColumn.style.display = "none";
if (currentJSONobject.panel_type_id == 1) {
fullContent.innerHTML = currentJSONobject.content;
}
//If half page
} else if (currentJSONobject.page_type_id == 2) {
fullColumn.style.display = "none";
if (currentJSONobject.panel_type_id == 2) {
leftContent.innerHTML = currentJSONobject.content;
} else if (currentJSONobject.panel_type_id == 3) {
rightContent.innerHTML = currentJSONobject.content;
}
}
$('#middle').css('background-image', 'url(' + currentJSONobject.background_img + ')');
counter += 1;
if (counter === obj.length) {
counter = 0;
}
}, 1500)
console.log(obj);
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script>
<div class="row middle">
<!-- Full Page Divs -->
<div class="col-lg-12" id="fullColumn">
<div class="fullContent" id="fullContent" style="height: 100%; ">
</div>
</div>
<!-- End Full Page Divs -->
<!-- Half Page Divs -->
<div class="col-lg-6 leftColumn">
<div class="leftContent" id="leftContent" style=" height: 100%; ">
</div>
</div>
<div class="col-lg-6 rightColumn">
<div class="rightContent" id="rightContent" style=" height: 100%; ">
</div>
</div>
<!-- End Half Page Divs -->
</div>