Ask Questions and Find Answers
Important:
Ask is now read-only. You can review any existing questions and answers, but not add anything new.
But - don't panic! While ask is no more, we've replaced it with discuss - the new Liferay Discussion Forum! Read more here here or just visit the site here:
discuss.liferay.com
RE: Show popup greeting on site load
Hi All
I need to show a popu greeting like below when the site loads:

Could anyone suggest how may I do this? Thanks
I am not sure what your issue is. I guess, you know how to show a modal dialog?
Just use AUI().ready() to execute your code to show it. For some circumstances you might also need to implement Liferay.on('endNavigate', ...
https://help.liferay.com/hc/en-us/articles/360017900872-Understanding-Your-Theme-s-JavaScript-Callbacks-in-main-js
https://help.liferay.com/hc/en-us/articles/360017886192-Automatic-Single-Page-Applications
Hi Christoph
I just tested and alert and it works, thanks a lot.
Hi Christoph
I can show the pouup now but the problem is it's happening on every page load. Would it be possible to set only on Homepage load? And also if possible only the 1st time. Appreciate if you could suggest some right way to accomplish this. Following is my current code inside man.js:
Liferay.on(
'allPortletsReady',/*
This function gets loaded when everything, including the portlets, is on
the page.
*/
function() {
// the dialog
Liferay.Util.openWindow(
{
dialog: {
destroyOnHide: true,
bodyContent: '<div id="dialogBody" class="bgimg"></div>',
centered: true,
height: 500,
width: 500,
},
dialogIframe: {
},
title: 'IXEON Greeting',
}
);}
);
Thanks
If you need to do it only on one page, you could either place the trigger in a webcontent or add a theme setting to enable the feature only on selected places.
To only show it once, you need to set a cookie that disables the popup after the first load. I just did a quick search and found e.g. this code https://gist.github.com/bavington/6727776
The same idea should work for you.
Hi Christoph
Could you tell a bit in detail on this "add a theme setting to enable the feature only on selected places"? How to do this theme setting? Thanks
--Rashed