Saturday, September 29, 2012

Re: splitting up image loads from rest of page

On Fri, Sep 28, 2012 at 1:48 PM, Larry Martell <larry.martell@gmail.com> wrote:
> I have a template that creates a table that has clickable links. It
> also loads a bunch of images associated with each row in the table.
> Through javascript events, when the user mouses over certain fields,
> the images are displayed or hidden. Initially, all the images are not
> displayed
>
> When the page loads, the table is produced quickly, but then there's a
> period of time before you can click on the links or mouse over and see
> the images. How long that period of time is seems directly related to
> how many rows there are in the table, so I'm assuming that time is
> being spent loading the images. Would that be a correct assumption?
>
> Assuming my assumption is correct, is there a way I can some how split
> this up, so the clickable links work as soon as the table is rendered,
> without waiting for the images? Also, the client is asking for me to
> display '... loading images' which goes away once they are all loaded.
> Can anyone tell me how I could do that?

For the archives:

What I did was to move the code that handles the clickable links into
a $(document).ready block (it was in a window.onload block). This
seems to be working fine for me - the links are active before the
images are loaded.

For the other part of this task (display '... loading images' which
goes away once all the images are loaded), I created the text with
display: none, then when the page is created I show() it, and in the
window.onload function I hide it. This also seems to be working fine.

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment