Welcome to TalkGraphics.com
Results 1 to 6 of 6
  1. #1

    Default Script request; handle multiple popups

    Hi,

    The sticky popup script by Covoxer is my "best friend" at the moment.

    I would love to have a script that works with above-mentioned script and makes the following possible:
    - close n number of popups
    - close n number of popups and open one more

    (I have to have the power to define which popups are closed and which one is opened)

    Is this doable?
    IP

  2. #2
    Join Date
    Aug 2004
    Location
    Ukraine
    Posts
    3,904

    Default Re: Script request; handle multiple popups

    Well, I think it's possible.

    You are adding the following code to the URL field of the closing object:

    javascript:my_close('mypopup1')

    If you want it to close multiple popups, add something like this:

    javascript:my_close('mypopup1');my_close('mypopup2 ');my_close('mypopup3')

    This will close mypopup1, mypopup2, mypopup3 simultaneously.

    Second will need additional scripting.
    Here's the improved script to use:
    Code:
    <script type="text/javascript">
    function my_clk(e){xr_xpul=0;xr_pul=0;if(my_oldclk){my_oldclk(e)};};
    var my_oldclk=document.onmouseup;
    document.onmouseup=my_clk;
    function my_close(my_name){var o=document.getElementById(my_name).parentNode; if(o.id=='')o=o.parentNode;xr_v0(o);};
    function my_open(my_name){var o=document.getElementById(my_name).parentNode; if(o.id=='')o=o.parentNode;xr_v1(o);};
    </script>
    With it, you can add my_open('my_popup') to the URL field to open a layer.
    So, for example, if you want to close "mypopup1" and "mypopup2" and open "mypopup3" and "mypopup4" simultaneously, you can add following string to the URL field:

    javascript:my_close('mypopup1');my_close('mypopup2 ');my_open('mypopup3');my_open('mypopup4');
    Last edited by covoxer; 23 March 2009 at 09:07 AM.
    John.
    IP

  3. #3

    Default Re: Script request; handle multiple popups

    Thank you again, John. You must be in the Top 10 of worlds javascript coders and propably the fastest of them all.

    With your new script everything works great except one hickup.

    My Popup1 has a button that will close Popup1 and open Popup2. What I experience now is that Popup2 is already open when I enter the page. Is that because we are not using the 'Web Properties/Link/Popup layer' option, which I guess keeps the targeted layers hidden until they are called up.

    If not, then I'm messign things up...
    IP

  4. #4
    Join Date
    Apr 2005
    Location
    Regional Victoria (Australia)
    Posts
    109

    Default Re: Script request; handle multiple popups

    Hi Markku
    Why do you need js? The power of WD on handling popups eg on MouseOver is GREAT and the explanation in the Help is excellent. On one page I have four popups which appear on mouseover for each of four objects (pics) & the BEST part of it is no js; you only need to get the hang of layers. WD handles it beautifully.
    td
    ===============
    Quote Originally Posted by Markku View Post
    Hi,

    The sticky popup script by Covoxer is my "best friend" at the moment.

    I would love to have a script that works with above-mentioned script and makes the following possible:
    - close n number of popups
    - close n number of popups and open one more

    (I have to have the power to define which popups are closed and which one is opened)

    Is this doable?
    IP

  5. #5
    Join Date
    Aug 2004
    Location
    Ukraine
    Posts
    3,904

    Default Re: Script request; handle multiple popups

    Yes. The layer is identified as a pop up only if you have at least one object that has set click pop up or mouse over pop up property to this layer.
    John.
    IP

  6. #6

    Default Re: Script request; handle multiple popups

    Thanks John, that is an okay work around.

    So I will put the "my_close, my_open" script to the actual button that I want the user to click, and to some other (more or less hidden) object I will add the click/mouseover popup property; only to keep the second popup closed.

    Good stuff.

    @Teedee; I know that, but I need this for some more advanced functions.
    IP

 

 

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •