Forums

Give help. Get help.

  • # January 9, 2014 at 5:56 pm

    Hey guys. Quick question. I’m working on a little app to help me get my JS game up and to use with responsive design. Basically, it just gives you the page width and height when I resize the window. Everything went good but when I tried to add a ‘close’ element I found myself a bit stuck. Simple setup, when I click the ‘close’ element I want to fade out the whole div. The way it is now is that when I click the ‘close’ element, only that element fades out. My question is what would be the most efficient way to achieve the result of the whole div fading out? Side note: If some of the code looks familiar it’s because I used some from the snipper section of this site (credit is given where credit is due as always). Also, while in code pen it won’t give me the pixel numbers live. I have to change the window size, reload, then I get the right numbers. I apologize in advance if that makes this harder. Thanks for any help as always guys.

    http://codepen.io/justdan/pen/CdAGb

    # January 9, 2014 at 6:16 pm
    function closeMe() {
      var close = document.getElementById('close');
      var box = document.getElementById('box');
      close.onclick = function() {
        box.className = 'hide';
      }
    }
    
    // Add id="box" to the div you want to hide
    
    # January 10, 2014 at 1:16 pm

    Glad everything worked out.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag