Hiding all but last div on page load with jQuery UI Accordion widget

407 views Asked by At

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?

2

There are 2 answers

1
nbrooks On BEST ANSWER
$(function() {
    $('div').hide();
    $('div:last').show();
});
2
Andy On

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

$('div:not(:last)').hide();