layers

They have: 2,390 posts

Joined: Nov 1998

Hi folks, its JP again with one of his random requests for help Smiling

I'm designing a website. To break down the problem simply it want to click on 1 of 4 links on the page and have a layer(a gif) pop up in the same place of the page (top left) with different data depending on which link was clicked. I want the layer to disapear when a link within the layer is clicked on.

could anyone guide me in th edirection of a similar script or help me in any other way? I had someone to do it but he, well, he didn;t so I'm stuck now.

c'mon guys, i brought you these forums Smiling pretty please

JP

druagord's picture

He has: 335 posts

Joined: May 2003

a easy way to do this would be to place you're layers manually and set visibility to hidden, then when you click a link it would call a javascript function that would set the layer needed to visible. a little search on google should give you some good exemple on what the function should look like

IF , ELSE , WHILE isn't that what life is all about

Megan's picture

She has: 11,421 posts

Joined: Jun 1999

Hi JP! HOpe things are going well! Sorry, no help here. I was looking for a hide/show layer script the other day (forget why...) but didn't have much luck in my limited search...

Renegade's picture

He has: 3,022 posts

Joined: Oct 2002

I saw the code on http://www.javascriptkit.com/cutpastejava.shtml sometime, I'm not too sure where though :S

dk01's picture

He has: 516 posts

Joined: Mar 2002

Here's a tutorial I wrote about hiding/showing layers. Should help with most of what you are trying to do.
http://www.conxiondesigns.com/tutorials/javascript/hideshow/
-dk

They have: 2,390 posts

Joined: Nov 1998

Just about to check out those leads but thought I'd point out how thick I was, actually posted in the wrong forum. Its been so long since i did any type of scripting I can't remember the difference between server and client side!! Sad

They have: 2,390 posts

Joined: Nov 1998

cheers guys, used dk's script which works fine but does not do everything i need it to.

check out http://www.petite-ecole.co.uk/temp/blueprint.html

if you click on the 'class des moyens' the main image disapears. thats perfect but...

I need to actually postition the new image (the kids on a bench over the blueprint. oh and i want it to be hidden when the page is loaded.

I'm sure the latter is easy to do but what about the positioning?

Again, thanks a lot. it's been a while since i've done anything but print design...
J

dk01's picture

He has: 516 posts

Joined: Mar 2002

Where are you wanting to position the image?
You should use css positioning if it needs to overlap the blueprint.
-dk

Mark Hensler's picture

He has: 4,048 posts

Joined: Aug 2000

Moved the thread.

Great to see you again, JP. Smiling

They have: 2,390 posts

Joined: Nov 1998

cheers Mark, nice to be home Smiling

thanks for your help dk, Megan, renegade...

i've updated http://www.petite-ecole.co.uk/temp/blueprint.html

now i have a few more problems (don't you just love javascript) and some solutions I'd love feedback on

1/ I want the layer hidden at first, dk can you tell me how to set it to hidden initially?

2/ because the positioning is absolute it looks weird at different resolutions. I have these two solutions a) align everything top left, that should work but will look ugly. b) open in dedicated fixed width window. again, not keen on that idea. can you use relative widths? would that work in different resolutions?

cheers again!
J

dk01's picture

He has: 516 posts

Joined: Mar 2002

Putting:
visibility: hidden;

in your css for that layer will hide it initially. Then it will be shown when you click on the showhide function link.

As for your second problem. You may want to consider adding in frames.

If you have a frameset with:

This way the screen can expand without having the absolute positioning getting messed up. And you won't have to use iframes!
Hope this helps.
-dk

They have: 2,390 posts

Joined: Nov 1998

i'll try the frame thang in a sec, thanks.

did:

to hide the layer at first but then it does not reapear onclick? Sad

what am i doing wrong?

dk01's picture

He has: 516 posts

Joined: Mar 2002

Change this:

to this:

-dk

dk01's picture

He has: 516 posts

Joined: Mar 2002

Just as an explaination,
The layer should be positioned and not the image itself. This is why the style goes in the div tag and not in the image tag.
-dk

They have: 2,390 posts

Joined: Nov 1998

ho hum and getting quite happy with this Smiling

thanks DK works well in IE (which is all I want). change dit a bit so its all on mouseover not onclick

http://www.petite-ecole.co.uk/temp/landing.html

cheers, thoughts appreciated.

JP

Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.