Hello
I installed wow, animate CSS and libraries on the latest bootstrap theme.
Everything has been installed correctly.
I encountered the following misbehavior:
Nodes are animated well if I use the animated class but "wow" doesn't seem to have any effect.
I noticed, though, that the script needed to initialize wow is missing so what I did was adding this
line
drupal_add_js('new WOW().init();', array('type' => 'inline', 'scope' => 'footer', 'weight' => 0));
to the wowjs.module at line 66 so now the fragment code looks like this:

  if ($page_match) {
    // There is a match. We load the wow.js library.
    libraries_load('wow');
    drupal_add_js('new WOW().init();', array('type' => 'inline', 'scope' => 'footer', 'weight' => 0));
  }

After patching the module, nodes are rendered correctly with the wow effect executing as it supposed to.
I'd like to know if anyone encountered this kind of issue and if what I did, actually solved the problem.

Comments

alfredo.ardito created an issue. See original summary.

GoddamnNoise’s picture

Hi alfredo.ardito,

The wowjs module loads the WOW JS library, but it doesn't intialize the WOW JS object because that kind of initialization could be different for each project.

You can use the Block Animate module, which it does initialize the WOW JS object and also let you configure animations for the blocks on your site from the Drupal's block configuration interface.

GoddamnNoise’s picture

Status: Active » Closed (works as designed)
alfredo.ardito’s picture

Hi,
thank you for the quick reply.
I installed the block animate module too previously and it seems this module doesn't initialize the WOW JS object as well.
However, I guess, it would be wise to inform users about the initialization needed to get WOW.js working as expected.
You could add this in the documentation.
WOW JS is good module anyway.

GoddamnNoise’s picture

Hi again, alfredo.ardito,

Yes, the BlockAnimate module does initialize the WOW JS object (see this), so maybe there is something in your theme preventing it to do that. Maybe a previous JS error could be the reason to that weird behavior.

You're right about that the users should be informed about the initlization needed to get WOW.js working as expected. I'll add that information to the module's documentation right now.

Thanks for your help!.

rahuldolas123’s picture

@alfredo.ardito,

Hey, your patch worked for me.

I added drupal_add_js part in module file. Earlier, the animation was executed on page load, now it works on scroll.

Thanks!

GiorgosK’s picture

Category: Bug report » Feature request
Status: Closed (works as designed) » Active

The way it is right now the proper way is in your theme's custom .js file put new WOW().init();

(function ($) {
  $(document).ready(function() {
    new WOW().init();
  }());
}(jQuery));

So marking this as a feature request

The maintainer should consider it since lots of people think its should be done by the module itself

GoddamnNoise’s picture

Hi GiorgosK,

The one and only thing this module is intended to do is to load the wowjs library. You can use the blockanimate module to do the initialization of the library or you can add that code in your theme as i've already explained in #5.

Thanks for your feedback.

GoddamnNoise’s picture

Status: Active » Closed (works as designed)
Albert Volkman’s picture

For future searchers, it's possible you're trying to get the WOW JS library to load on a Panels page. Since this module initializes the library within hook_page_build() instead of hook_init(), it won't load. You'll need to either manually load it in your local JS, or this module would need to switch hooks.

GoddamnNoise’s picture

Thanks for your comment, Albert. I've never used the Panels module, so I really appreciate your comment, which i hope will be useful for anybody using Panels.

Back From 7’s picture

Can't get this module to work. Documentation is lacking.

GoddamnNoise’s picture

Hi, joedevdrupal,

If you provide more information about your configuration, maybe we could help you. You've a lot of documentation on the module's page.

Back From 7’s picture

I went ahead and installed a vanilla installation wow.js via mytheme.libraries.yml

Working now.

GoddamnNoise’s picture

Hi joedevdrupal,

Great!, probably there is no need to develop a WOW JS module for Drupal 8 then.