Need help with closing and open divs with Javascript

Discussion in 'JavaScript' started by drmacs, Mar 2, 2010.

  1. #1
    Hi!

    I'm working on a website where I need some help with open and closing divs using javascript.

    This is the website: http://www.clashjeans.se/test/styles.html

    As you can see I'm using a javascript to open each jeans style link, I don't know if this is the best way to do it, but it's how I've done it so far. If you click the "Frankie style link" at the bottom the div called Frankie will show and you will see a little image in that div that says "next wash". What I would like this link to do is to close the frankie div and open up another wich looks almost the same as the previous, the only thing that will change is the pictures actually. Please help me solve this problem, any suggestion about how to make this work will be highly appreciated!
     
    drmacs, Mar 2, 2010 IP
  2. Imozeb

    Imozeb Peon

    Messages:
    666
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You should just use one div tag called "pic" then use Javascript to change the "pic.src" to another image source when the user clicks the new link. If your querying data from a database you should use AJAX to do the swap.
     
    Imozeb, Mar 2, 2010 IP
  3. drmacs

    drmacs Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #3
    Ah! Sounds like a plan! I'll see what i can do with it.
    Thanks!
     
    drmacs, Mar 2, 2010 IP