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!
Comments
Comment #2
nikro commentedHere's the patch :)
Comment #3
nikro commentedComment #4
nikro commentedOkayyy, in some cases adding Drupal to the top, yields errors, reverting just to 1 line change.
Comment #5
Brainstormer59 commentedHi Nikro, I needed the same functionality as you.
Your patch#4 works great.
Thanks again for your patch.
Comment #6
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 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.blazyas the patch suggests, since it should match to module name.