Link to home
Start Free TrialLog in
Avatar of Panos
PanosFlag for Germany

asked on

Position jquery ui dialog popup window.

Hello experts.
I have a working code from expert senthurpandian to show a popup window and get the content of another page:https://www.experts-exchange.com/questions/25905726/Jquery-ui-dialog-window.html

How can i position the popup at the bottom right corner of my page or right top?
<script type="text/javascript">
        $.ui.dialog.defaults.bgiframe = true;
        /*$(function() {
                $("#dialog").dialog();
        });*/
        </script>
<div class="demo">

<div id="dialog" style="visible:hidden;" title="* Article Updates."></div>
</div><!-- End demo-description -->

<script>

        var timerID = null;
        var timerRunning = false;
        var delay = 20 * 1000; // Time interval mins * sec * mili-sec (change mins only)

        function StopTheClock()
        {
			if(timerRunning)
			{
					clearTimeout(timerID);
			}
			timerRunning = false;
        }

        function StartTheTimer()
        {
			timerRunning = true;
			timerID = setTimeout("AjaxTimeOut()", delay);
        }

        function AjaxTimeOut()
        {
                StopTheClock();
                $.ajax({
                        type: 'GET',
                        url: '../user/getlastentries.cfm', 
                        success: function(AjaxHTML){
							//alert(AjaxHTML);
							if(AjaxHTML.indexOf("@123465789@for-telling-page-has-contents@@@") > 0) // Means it has content
							{
								$("#dialog").html(AjaxHTML);
								if(!$("#dialog").dialog("isOpen"))
								{
									$("#dialog").dialog("open");
									$("#dialog").dialog("moveToTop");
								}
							}
                        }
                });

                StartTheTimer();
        }

		$(document).ready(function(){
			// Init
			$("#dialog").dialog()
			if($("#dialog").dialog("isOpen"))
			{
				$("#dialog").dialog("close")
			}
			// Init end
			AjaxTimeOut();
		});

</script>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of StealthyDev
StealthyDev

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Panos

ASKER

Hi again.
It is working fine.
If you have noticed i did change the ### singns with @@@ in the previous question.Coldfusion use this (#) in his language so i needed to change it.

thank you.
Avatar of Panos

ASKER

thank you again

regards panos
Avatar of StealthyDev
StealthyDev

Thats great!

All the best :)
Best Regards