1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

please help

Discussion in 'JavaScript' started by paffdevel, Feb 25, 2016.

  1. #1
    hello,
    please help with the code - https://jsfiddle.net/kd2p1zsa/1/
    thanks
     
    paffdevel, Feb 25, 2016 IP
  2. sarahk

    sarahk iTamer Staff

    Messages:
    28,500
    Likes Received:
    4,460
    Best Answers:
    123
    Trophy Points:
    665
    #2
    Try this in the javascript panel
    
     var oldClass;
    
     $('input[name="o1"]').on('click', function() {
    
       $(oldClass).fadeOut('slow');
       var newClass = '.'+$(this).val();
       $(newClass).fadeIn('slow');
    
       oldClass = newClass;
     });
    Code (markup):
     
    sarahk, Feb 25, 2016 IP
  3. denis bayly

    denis bayly Well-Known Member

    Messages:
    104
    Likes Received:
    28
    Best Answers:
    6
    Trophy Points:
    105
    #3
    Hi there paffdevel,

    if you are at all interested, this can easily be done with CSS..

    
    
    <!DOCTYPE html>
    <html  lang="en">
    <head>
    
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    
    <title>untitled document</title>
    
    <style media="screen">
    #holder {
        position:relative;
     }
    .sell,.buy,.transport{
        position:absolute;
        z-index:0;
        opacity:0;
        background-color:#fff;
        transition:all 1.5s ease-in-out;
     }
    #sell:checked~#holder .sell,
    #buy:checked~#holder .buy,
    #transport:checked~#holder .transport {
       z-index:3;
       opacity:1;
     }
    </style>
    
    </head>
    <body> 
    
    <input type="radio" name="o1" id="sell" value="sell">
    <label for="sell">test</label>
    
    <input type="radio" name="o1" id="buy" value="buy">
    <label for="buy">test</label>
    
    <input type="radio" name="o1" id="transport" value="transport">
    <label for="transport">test</label>
    
    <div id="holder">
     <div class="sell">1</div>
     <div class="buy">2</div>
     <div class="transport">3</div>
    </div>
    
    </body>
    </html>
    
    Code (markup):

    coothead
     
    denis bayly, Feb 25, 2016 IP