Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
Hey guys, I decided to use this module instead of writing my own integration - I don't need the text-filters nor field settings for now, just the library itself (with a nice settings form that you did).
Anyway, here in lazy.js:
var options = settings.lazy.bLazy ? settings.lazy.bLazy : {};
new Blazy(options);
It would be nice if you'd export it to the global scope, under Drupal variable:
var options = settings.lazy.bLazy ? settings.lazy.bLazy : {};
Drupal.blazy = new Blazy(options);
This would allow me and others use global blazy functions within my theme (like Drupal.blazy.revalidate()
).
I'll attach the patch below, thanks!
Comment | File | Size | Author |
---|---|---|---|
#4 | lazy-blaz-global-3015862-4.patch | 331 bytes | Nikro |
#2 | lazy-blaz-global-3015862-2.patch | 396 bytes | Nikro |
Comments
Comment #2
Nikro CreditAttribution: Nikro as a volunteer and commentedHere's the patch :)
Comment #3
Nikro CreditAttribution: Nikro as a volunteer and commentedComment #4
Nikro CreditAttribution: Nikro as a volunteer and commentedOkayyy, in some cases adding Drupal to the top, yields errors, reverting just to 1 line change.
Comment #5
Brainstormer59 CreditAttribution: Brainstormer59 commentedHi Nikro, I needed the same functionality as you.
Your patch#4 works great.
Thanks again for your patch.
Comment #6
Brainstormer59 CreditAttribution: Brainstormer59 commentedHi Nikro, I needed the same functionality as you.
Your patch works great.
I needed to revalidate blazy after a carousel state change like this:
$('#slick-slider').on('afterChange', function(){Drupal.blazy.revalidate();});
Thanks again for your patch.
Comment #7
mrconnerton CreditAttribution: mrconnerton at Sagetree commentedPatch in #4 works well. Very useful for revalidate in theme.
Comment #9
osmanThanks for the patch and reviews. It's now fixed in 7.x-1.x-dev.
Notice that the namespace is
Drupal.lazy
; notDrupal.blazy
as the patch suggests, since it should match to module name.