I need to move map and then need to show dialog. Following code show dialog and then map gets move which is exactly opposite behavior.
function showDetails(property_id)
{
map.panBy(300,0);
sleep(3000);
window.showModalDialog("<?php echo base_url();?>index.php/admin/add_property_from_map/"+18+"/"+73);
}
function sleep(ms)
{
var dt = new Date();
dt.setTime(dt.getTime() + ms);
while (new Date().getTime() < dt.getTime());
}
As Dr. Molle points out. Your sleep() function is blocking all access to any other code being run. Use the setTimeout function. Something like this: