here in drop function i am calling the show div after each value is iterated from array.the showdiv function sets the div to display:block;
and shows the data inside it.in show div function i am trying to hide the div every 3.5 seconds after it has been shown and when again the next iteration is done it is not showing the div again, for only first time it shows the div for some times and it will hide the div. and again when it calls the showdiv function it is not showing the div.
i want to show div and after 3.5 seconds i want to hide div.how can i do this?
function drop() {
clearMarkers();
for (var i = 0; i < locations.length; i++) {
var city = locations[i][0];
var pro_cat = locations[i][1];
var marker_icon = locations[i][3];
var product_image = locations[i][4];
var marker_src =
addMarkerWithTimeout(locations[i][2], i * 500, marker_icon);
//alert("dropped");
getCity(city,pro_cat, i * 500);
if(product_image == null)
{
//if image found in row-do nothing
}
else {
//if image found
showdiv(city,product_image, i * 500);
/*window.setTimeout(function() {
hidediv();
},2500);*/
}
}
}
function showdiv(city, imagesrc, timeout)
{
window.setTimeout(function() {
document.getElementById('city-order').innerHTML = "";
document.getElementById('order-product').innerHTML = "";
$('.product-display').addClass("zoomin");
//document.getElementById('product-view-display').style.display = "block";
document.getElementById('product-list-display').style.display = "block";
var order_placed_city = document.getElementById('city-order');
var content = document.createTextNode(city);
order_placed_city.appendChild(content);
var product_order = document.getElementById('order-product');
var elem = document.createElement("img");
product_order.appendChild(elem);
elem.src = imagesrc;
},timeout);
window.setTimeout(function() {
document.getElementById('product-view-display').style.display = "none";
},3500);
}