• Resolved victorwyee

    (@victorwyee)


    Hello — I recently started using SimpleViewer in my WordPress posts. The posts where I’m using SimpleViewer contain the SimpleViewer gallery at the top of the page, followed by a few paragraphs of text. The issue, though, is that the paragraphs of text show up before the SimpleViewer gallery does. So this creates an effect where for a split second, all the viewer sees is text, all of which is then pushed down below the fold by the gallery.

    Is there any way to render the SimpleViewer gallery before the rest of the post is shown? Or, alternatively, is there some way to “save” the space where the SimpleViewer gallery will eventually load (i.e. with placeholder whitespace or image), so that layout of post doesn’t change a split second after the post is shown to the viewer?

    Thanks!

    http://wordpress.org/plugins/wp-simpleviewer/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Steven

    (@steven-speirs)

    SimpleViewer waits until the page is ready before embedding the gallery (using jQuery’s $(document).ready() function).

    Here are two things you can try:

    (1) Open the ‘wp-simpleviewer/wp-simpleviewer.php’ file in a plain text editor and change lines 951-960 (inclusive) from:

    <!--START SIMPLEVIEWER EMBED-->
    <script type="text/javascript">
    	var flashvars$gallery_id = {};
    	flashvars$gallery_id.galleryURL = "$gallery_url";
    	simpleviewer.ready(function () {
    		simpleviewer.load("sv-container$gallery_id", "$gallery_width", "$gallery_height", "$background_color", $use_flash, flashvars$gallery_id);
    	});
    </script>
    <div id="sv-container$gallery_id"></div>
    <!--END SIMPLEVIEWER EMBED-->

    … to:

    <!--START SIMPLEVIEWER EMBED-->
    <div id="sv-container$gallery_id"></div>
    <script type="text/javascript">
    	var flashvars$gallery_id = {};
    	flashvars$gallery_id.galleryURL = "$gallery_url";
    	simpleviewer.load("sv-container$gallery_id", "$gallery_width", "$gallery_height", "$background_color", $use_flash, flashvars$gallery_id);
    </script>
    <!--END SIMPLEVIEWER EMBED-->

    (2) If all your galleries are of the same height, then open the ‘wp-simpleviewer/wp-simpleviewer.php’ file in a plain text editor and change line 959 from:

    <div id="sv-container$gallery_id"></div>

    … to something like:

    <div id="sv-container$gallery_id" style="height: 600px;"></div>

    Hopefully one of these two suggestions will help.

    Thread Starter victorwyee

    (@victorwyee)

    Thanks Steven! The second suggestion worked (and incidentally all of my galleries so far have the same height); the height attribute reserves some whitespace for SimpleViewer. The first suggestion didn’t seem to make any noticeable effect.

    Thanks again for your help!

    Steven

    (@steven-speirs)

    I’m glad that one of my suggestions worked for you.
    Thank you for posting back to let me know.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Render SimpleViewer before rest of post’ is closed to new replies.