views:

40

answers:

2

I'm using jcarousel and I'm loading in a large list of image thumbnails (200 - 600). The problem is that the while the page loads, the thumbnails show up on the page briefly, and then once they finish loading the jcarousel takes over and hides them. I'm wondering if there is a way to hide them from the get go.

A: 

You can just declare the thumbnails' CSS to be display: none to begin with.

Actually, when is jcarousel being initialized? It could also be that you're initializing jcarousel on document.onload, which is AFTER everything has loaded. By running the initialization code within $( initialize_function ), it will run when the DOM is ready but before everything else is loaded.

erjiang
`display:hidden;` won't do anything.
Jeff Rupert
@Jeff, you're right, but it's easy enough to get `visibility: hidden` and `display: none` confused.
David Thomas
My bad. I don't know what I was thinking of but it wasn't CSS.
erjiang
@David: I know, I've done it before. Just wanted to let erjiang know. =) @erjiang: No worries.
Jeff Rupert
@Jeff, @erjiang, we've all done it. And sat there for ten minutes looking bewildered when it doesn't work. And then embarrassed when we realised... =)
David Thomas
I'm running the jcarousel code in $(document).ready(function() { // init code goes here }
Mark Steudel
Anyway that wouldn't have worked since jcarousel doesn't actually unhide images, it just uses overlfow:hidden
Mark Steudel
+1  A: 

You can always use plain old css:

img.thumbnails {
    display: none;
}
David Thomas
i'll give this a try. I tried the other li's but the carousel didn't unhide them ...
Mark Steudel
I tried this, but jcarousel doesn't know to unhide the thumbnails to hide them. We ended up looking at the styles that jcarousel applied to the thumbnails and applied them via css, so part of the work was already done. Basically the way jcarousel hides the images is to use overflow:hidden
Mark Steudel
@Mark, given that you solved the problem differently than the suggestions here, you should probably add an answer to this question detailing what you did, and accept *your own* answer. Nicely done =)
David Thomas