Is it possible to define a variable in a JQuery dialog and use it in its events. E.g. in this example:
element.find(".dialog").dialog(
{
title: settings.title,
close: function () {
$(this).remove();
},
open: function () {
var map = new Map();
},
height: $(window).height() / 1.5,
width: $(window).width() / 1.5,
resize: function () { map.updateSize(); }
}).dialogExtend({
"maximize": true,
"events": {
"maximize": function () { map.updateSize(); },
"restore": function () { map.updateSize(); }
}
});
I want to use the map variable in the resize event, but I get an error that says map is not defined. How can I solve this problem?
Try below snippets in the respective places:
Replace open with:
And
Edited by xsl: This worked for me:
And: