0

I have looked at the examples in another post on this site about hiding divs on page load, but the problem I'm having is with my last div. The last div contains galleriffic content that is dynamically loaded based on the photos that are clicked on.

I have tried hiding the div using css and javascript, and they both worked. They worked too well, however, because the gallerific content would not show in the last div after the page loaded. I have the last div set as active on the page load, which is how I want the page to start out when it is loaded.

Any suggestions on this?

Community
  • 1
  • 1
Dennis
  • 3
  • 3
  • If you hide the div, it will be hidden, until you change it's display state. You will need to identify once the content has loaded, then once complete, you'll need to use `.show()`. – Ohgodwhy Jul 24 '13 at 22:01

2 Answers2

0
$(function() {
    $('div').hide();
    $('div:last').show();
});
nbrooks
  • 18,126
  • 5
  • 54
  • 66
  • Thanks for the input. Although this did not solve my problem it got me looking in the right place. What I discovered was that the div was getting hidden and then shown correctly. However, there were grandchild divs that were part of the galleriffic container that were getting hidden and staying hidden. The solution ended up being done with CSS.. instead of #accordion div { display: none; } I used #accordion > div { display: none; } which only turned the display off for the direct children. – Dennis Jul 25 '13 at 16:05
0

I don't know your markup, but something like this should work:

$('div:not(:last)').hide();
Andy
  • 29,707
  • 9
  • 41
  • 58
  • Thanks for your help on this, see comment above. – Dennis Jul 25 '13 at 16:05
  • @Dennis you could try $('div:not(:last)').css('opacity',0); which still renders the div and everything inside it but it's invisible. – Andy Jul 25 '13 at 18:48