Remove Initial Flicker With Smooth Gallery
I recently created a site (in beta testing now) with Smooth Gallery and the client loved it.
The Problem:
The only issue was that upon the initial page load – all items in the gallery would flicker for a second or two while the first image loaded – causing this to not look professional at all.
The Solution:
- HTML: I took the example code:
<div> <div class="imageElement" id="element"> <h3>Item 1 Title</h3> <p>Item 1 Description</p> <a href="#" title="open image" class="open"></a> <img src="images/brugges2006/1.jpg" class="full" /> <img src="images/brugges2006/1-mini.jpg" class="thumbnail" /> </div> </div>
I then added an ID to each div (id=”element1″) so that each div had a class of “imageElement” and a unique ID (element1, element2, etc).
- CSS: Now that I had IDs to style, I added the following to my style sheet:
#element2 {display: none;}
By adding the 2 bits of code mentioned below, I was able to initially hide the content in the second div so that only the content in the first div appeared on page load. Once the script started running, it then changed the display from none to block automatically. Problem solved.
There is obviously a lot to know about this.
I seem to have exactly the same problem. Could you identify which file the amended html should be in please. Also, could you post an example of the completed code as I’m a little unsure where you are inserting the unique id.
I updated the code above to show everything in action.