Take the 2-minute tour ×
Drupal Answers is a question and answer site for Drupal developers and administrators. It's 100% free, no registration required.

I have a custom content type, with an associated block, which all displays correctly. The block is initially hidden, upon clicking a button the block is moved into view, and the user is able to scroll horizontally through each content item.

Each content item contains an image, so I am interested in preventing them from being loaded initially, and only when the button is clicked (in order to reduce initial loading time).

I don't suppose there is a Drupal way of doing this? The only way I can think of is making direct calls to the database, which I don't want to do for obvious reasons.

I noticed a "Use Ajax" option in the Views interface, however I wouldn't have thought this would work with my custom jQuery code?

share|improve this question
    
Does this help ? .. OK just noticed an old question. –  GoodSp33d Oct 25 '12 at 5:45

2 Answers 2

You might try the Lazy Image Loader. I'm not sure if it will work for your case, but it's worth a shot. You can also implement the lazy behavior yourself. Use javascript to test the "complete" property of each image, and change the src attribute on any image that currently hidden from view. When it becomes visible, swap in the original src. I've seen good results with this script: http://www.appelsiini.net/projects/lazyload.

share|improve this answer

You can also use Ajax Blocks module which permits to load some blocks by additional AJAX request after loading the whole cached page when the page is viewed by anonymous user.

This module works well when you want to ajaxify some Drupal blocks.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.