delay loading of deputies pictures after the page is fully loaded

This commit is contained in:
Frédéric Péters 2012-05-04 10:24:45 +02:00
parent 6719016cdc
commit b5325137f7
1 changed files with 11 additions and 3 deletions

View File

@ -27,11 +27,19 @@
<dt id="fieldsetlegend-photographies">Répertoire photos de A-Z</dt>
<dd id="fieldset-photographies">
<script type="text/javascript">
/* delay loading of deputies photos after the page is fully loaded */
jQuery(window).load(function(){
$('#fieldset-photographies a').each(function() {
$(this).find('span').before('<img src="' + $(this).attr('data-src') + '"/>');
});
});
</script>
<tal:block tal:repeat="entry view/sortedDeputies">
<div tal:condition="entry/picture">
<a tal:attributes="href entry/absolute_url"><img
tal:attributes="src string:${entry/id}/photo"/>
<span tal:content="entry/Title"/>
<a tal:attributes="href entry/absolute_url;
data-src string:${entry/id}/photo;">
<span tal:content="entry/Title"/>
</a>
</div>
</tal:block>