By V I R U S on
Hello everyone!
As new Drupal 7 will be released soon (hopefully soon =) ) i'm trying to creade some modules, so that after D7 is released we can start with our page.
I found one cool jQuery plugin, named Lazy Load but got some troubles to get to run it.
I've saw the Lazy Load for D6, it's not that hard, but i don't need all this admin stuff and other, i'm just trying to get all image files to run over it.
The plugin can be found here: http://www.appelsiini.net/projects/lazyload
So, that the part i't using to load the needed JS code:
function lazyload_init() {
$path = drupal_get_path('module', 'lazyload');
drupal_add_js($path . '/jquery.lazyload.js', 'file', 'header', true);
drupal_add_js('$(function() {
$("img").lazyload({
placeholder : "' . $path . '/images/grey.gif",
});
});', 'inline', 'header');
}
Of cource all files are at the needed place, thay are loaded and found.
Hope someone could help me to solve this trouble. Thanks!
Comments
I think you are unlikely to
I think you are unlikely to get help if you don't actually say what the problem is!
Contact me to contract me for D7 -> D10/11 migrations.
In
In D7:
D7 uses Drupal.behaviors
D7 uses Drupal.behaviors instead of $(document).ready():
Edit: also, if you don't remove the trailing comma after your filepath (I've removed it above), IE will throw an error.
Contact me to contract me for D7 -> D10/11 migrations.