Sunday, 18 August 2013

jquery jDialog deson't work properly when we call it many times

jquery jDialog deson't work properly when we call it many times

I'm using jdialog, everything works fine, but when I show up the same div
many times it freezes, if i refresh the page everything works fine again.
I even tried to generate a dynamic id for the div
here the code:
/* * */ function open_jdialog(url, div_id,dialog_title, dialog_width,
dialog_height,top_position) { try { if (trim(div_id)=="") {
div_id="host_div_id" }
if (typeof(top_position)==='undefined')
{
top_position=100
}
host_div=document.getElementById(div_id)
key=generate_key();
host_div.innerHTML="<div id=" + key + "></div>"
url=url + "&div_to_close=" + key
get_data_via_ajax( url ,key)//get
//
if (dialog_width==0) dialog_height="auto"
if (dialog_height==0) dialog_height="auto"
//
$("#" + key).dialog({
width: dialog_width,
height: dialog_height,//$(window).height(),
modal: true,
title:dialog_title,
position: ["centre",top_position],
zIndex: 0,
});
$('#' + key).bind('dialogclose', function(event)
{
document.getElementById(div_id).innerHTML=""
//document.getElementById(div_id).reset();
});
}//end try
catch(err)
{
}
}

No comments:

Post a Comment