Popup - hide()

Popup is really nice. I like that it is possible to add a layout and a grid and the progress indicators work so well.

I have a situation where the I open the popup and would like for it to close when anything on the page is clicked.

It seems odd, when the popup is opened, you can click the body of the page and then on the 2nd click it then closes. Can it be closed on the first click?

Here is sample code:

	<script>
		var myPop;
		function showPopup() {
			if (!myPop) {
				myPop = new dhtmlXPopup();
				myPop.attachHTML("Testing 1...2...3");
			}
			if (myPop.isVisible()) 	myPop.hide();
			else 	myPop.show(20,30,100,40);
		}
		function hidePopup() { if (myPop) myPop.hide(); }
	</script>
	<br>	
	<br>	
	<a href="javascript:showPopup()">Click to Select</a>

Could you attach a complete demo that reproduces the problem ?

Here is a link to a small concise working demo:

http://tc.databaseknowledge.com/dhtmlx/dhtmlxSuite_v36_pro_130417/dhtmlxSuite_v36_pro_130417/dhtmlxPopup/samples/01_init/testing.html

This particular server is very slow, it should be fine for testing.

Please try use the following link

Click to Select

instead of Click to Select

Also there is no need to use hide() in showPopup method. As click on link will call the same event on body. So, showPopup function can be modified as follows:

function showPopup() {
if (!myPop) {
myPop = new dhtmlXPopup();
myPop.attachHTML(“Testing 1…2…3”);
}
if (!myPop.isVisible())
myPop.show(20,30,100,40);
}

Perfect!!! Thank you!