Create link to pop-up on another page
Hey guys,
Hope you are all well. I have a site with a regular navbar that has a Home page, About, Services, etc... so on the services page, there are a few buttons, listing the different types of services. Each button then opens a popup with the information for that particular service. I have about 8 of these popup layers. Now I have already added some Javascript Voodoo that automatically opens the "first" popup on page load and will stay open until you click on another button, which then opens THAT particular service popup and closes all other Popups. So essentially, you will always have only 1 popup displayed at any given time, without the possibility of stuffing it up. So that's all good.
Now, the client wants about three "shortcuts" on the Home page, for 3 of the services, that links directly through to that service info. So ideally, I want to be able to create a link on the home page that will open the Services page and open the relative popup as well, otherwise you would just land on the services page, the default popup will display and then you still have to click on that particular service to open that popup.
Any ideas?
I did search the forum for something like this before and wasn't very successful, but I do apologize if this was dealt with before.
Thanks in advance.
Re: Create link to pop-up on another page
Frodo, it would help if you told us what the "Voodoo" was.
I did something here: https://www.talkgraphics.com/showthr...898#post601898.
This pops open a Named layer.
In essence each new Layer will have a name with an initial capital and one object on the new layer has a lower case Name.
Each needs to be called from the MouseOff layer as a normal Pop-up layer Link on a shape or button. These can be hidden.
You can add a Close shape, image or icon to close the popped-up layer.
To complete the set, each calling link from the NavBar has a Link of form:
Code:
javascript: xr_v1(document.getElementById('spam').parentNode.parentNode);
'spam' is the Name of the object on the Spam Layer.
In the end, you may not need the code also in the Page HTML code (body) for your requirements.
Acorn
Re: Create link to pop-up on another page
Hi Acorn,
Thanks for the response. I actually used your method, as per your link. Been using that for quite some time for these situations. So I prefer to not have a Close shape, as the other "Open" shapes for all the other popup layers already includes the close command for any and all popups, bar the one being opened.
The question is more aimed at putting a single link on a page (Page A) that will do 3 things:
1. From page A Direct you to another page (Page B)
2. Ignore above mentioned Java Script that opens the "first" popup layer by default
3. Open the desired popup layer as specified within the link on Page A
Does this make sense? I tried creating a link within the first field of the properties of my link on page A in a misguided attempt, something to this effect:
page:"B", popup:"layer4", close:"layer1","layer2","layer3" etc...
This obviously failed. I tried a few other iterations with and without quotation marks, also tried using: page:"B.html", popup:"....etc...". Without success. Does this shine any more light?
Re: Create link to pop-up on another page
Quote:
Originally Posted by
Frodo
Hi Acorn,
Thanks for the response. I actually used your method, as per your link. Been using that for quite some time for these situations. So I prefer to not have a Close shape, as the other "Open" shapes for all the other popup layers already includes the close command for any and all popups, bar the one being opened.
The question is more aimed at putting a single link on a page (Page A) that will do 3 things:
1. From page A Direct you to another page (Page B)
2. Ignore above mentioned Java Script that opens the "first" popup layer by default
3. Open the desired popup layer as specified within the link on Page A
Does this make sense? I tried creating a link within the first field of the properties of my link on page A in a misguided attempt, something to this effect:
page:"B", popup:"layer4", close:"layer1","layer2","layer3" etc...
This obviously failed. I tried a few other iterations with and without quotation marks, also tried using: page:"B.html", popup:"....etc...". Without success. Does this shine any more light?
The Xara undocumented popup code does not work across pages. i have also just checked and my code, equally, will not function across pages.
The trick is yet more code.
If the url has a hash, jump to that anchor on the layer (e.g., url#fred --> open page with Layer Fred open).
If no hash, open page with default Layer (e.g., Layer Spam; same as url#spam).
The code will be something like:
Code:
<script> var hash= location.hash.substr(1);
if (hash == "") {
xr_v1(document.getElementById('banner').parentNode.parentNode);
}
else {
xr_v1(document.getElementById(hash).parentNode.parentNode);
}
</script>
To open the Spam layer, the calling Link will be <Page filename>.htm#spam.
To open the default pop-up layer (banner), the calling Link is the normal <Page filename>.
This code allow for any number of pop-up layers.
You set the default by changing "banner".
Acorn
1 Attachment(s)
Re: Create link to pop-up on another page
A working example: Attachment 123626
Acorn
Re: Create link to pop-up on another page
I just checked that Link to Anchor (e.g., spam) also works.
Acorn
Re: Create link to pop-up on another page
Benignly, a call to an Anchor on the page goes to the anchor and does not open any of the Layers.
Acorn
Re: Create link to pop-up on another page
Acorn... you are the bomb!
This works great! However...
Lol, sorry, but the only draw back I am still sitting with, is that it opens the page, and it opens the popup layer, but the screen doesnt anchor down to the position on the page where the popup layer is open like it does in your sample... ??:think:
What's more puzzling, is that at one point, it did do that, but I had named an object quite low down on the layer and it took the screen way to low, so I rethought it and named something else. That gave me the result above, where it opens the page and layer but it doesnt go down to the anchor position. I have now even reverted to naming a new rectangle right in the middle of nowhere and it still does not go down to that position.
I know I must be missing something small somewhere...
Re: Create link to pop-up on another page
Quote:
Originally Posted by
Frodo
Acorn... you are the bomb!
This works great! However...
Lol, sorry, but the only draw back I am still sitting with, is that it opens the page, and it opens the popup layer, but the screen doesnt anchor down to the position on the page where the popup layer is open like it does in your sample... ??:think:
What's more puzzling, is that at one point, it did do that, but I had named an object quite low down on the layer and it took the screen way to low, so I rethought it and named something else. That gave me the result above, where it opens the page and layer but it doesnt go down to the anchor position. I have now even reverted to naming a new rectangle right in the middle of nowhere and it still does not go down to that position.
I know I must be missing something small somewhere...
Frodo, can't really help but i just added an ordinary anchor to the pop-up layer and it opens into the layer and moves to the right anchor position.
Acorn