Paul Vincent Paul Vincent - 1 year ago 99
jQuery Question

Reverse list and delay display

I have a simple script on my site to reverse the display of a list.

$('li.shoplist').each(function() {

It works great, but the reversal of the list occurs after / during page load — and thus the list (which is largely imagery) appears and then snaps into reverse order, which looks a little clunky.

Is there a way to delay the display of the list until after it has reversed?

Thanks in advance.

Answer Source

You could use the style display: none in your HTML, something like:

<ul style="display:none">

..and then during the loading of the page you show the list at the end:

$(function() {

    $('li.shoplist').each(function() {

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download