Two Links, change the content of DIVs - how?

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
simonmlewis
DevNet Master
Posts: 4435
Joined: Wed Oct 08, 2008 3:39 pm
Location: United Kingdom
Contact:

Two Links, change the content of DIVs - how?

Post by simonmlewis »

http://www.willmaster.com/library/featu ... nother.php
This is similar to what I need.
We look after a flooring website and they want to have a link that says "Closeup" and one that says "Slab", so they can view either images. I don't want to toggle the link - I want two separate links.
But I want them to control what is shown in the DIV. So either clicking them changes the content of the div, or might be better if clicking the links, chose which DIV to show. That way I can control the layout of each div (As the images in them may be different sizes).
Love PHP. Love CSS. Love learning new tricks too.
All the best from the United Kingdom.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Two Links, change the content of DIVs - how?

Post by Celauran »

It's basically the same approach. Rather than passing two divs to swap, each link toggles the visibility of its related element.
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Two Links, change the content of DIVs - how?

Post by Celauran »

Very simple example: https://jsfiddle.net/wgnpm4zb/
Post Reply