treehouse : what would you like to learn today?
Web Design Web Development iOS Development

simple tabs integration

  • I implement in my gallery a tabbing system, I have two tabs "gallery1" and "gallery2", first tab it's ok but 2nd tab loads only 1 image, I think something is positioned incorrect in css because the javascript code is fine, but I can't figure out what exactly.
    Take a look here
  • Well you would be wrong. It is actually your JavaScript which is setting the width of the second tab .container to width:0px on page load. Stop it from doing this otherwise the images will each appear on a new line, which is what is currently happening
  • I don't think so because if you are refering to this
    //the image will be positioned on the center,
    //with width and height of 0px
    $this.css({
    'width' : '0px',
    'height' : '0px',
    'marginTop' : w_h/2 +'px',
    'marginLeft': w_w/2 +'px'
    });
    $preview.append($this);

    Is not from there, and if I remove the tabs the gallery is working fine...
    1. Open a decent web browser like Chrome
    2. Click on the Gallery 2 Tab
    3. Right click on the Gallery Section and click Inspect Element
    4. Look at the div class=container and see that it has width=0px set
    5. Click on this element in the element inspector, then in the right hand pane untick width:0px in the element.style section
    6. Voila, your gallery appears....
  • Thanks, if I remove the width=0px the gallery appears but as you've probably noticed the horizontal scrolling of thumbnails doesn't work anymore...
    So I think the mistake is in my html markup ( the integration of the tabs in the gallery}