Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WOW not defined using npm package. #252

Open
jasonlam-swatow opened this issue May 24, 2016 · 32 comments
Open

WOW not defined using npm package. #252

jasonlam-swatow opened this issue May 24, 2016 · 32 comments

Comments

@jasonlam-swatow
Copy link

I did this:

npm install wowjs

and required it:

import WOW from 'wowjs

and tried to use it:

let wow = new WOW({
  boxClass: 'wow',
  animateClass: 'animated',
  offset: 0,
  live: true
});

But I got Uncaught ReferenceError: WOW is not defined at console.

@graingert
Copy link
Contributor

graingert commented Jun 8, 2016

@jasonlam0619 run:

npm install wow.js

Then use:

import WOW from 'wow.js'
const wow = new WOW({
  boxClass: 'wow',
  animateClass: 'animated',
  offset: 0,
  live: true
});

@suarezph
Copy link

suarezph commented Sep 6, 2016

Hi grain I used wow.js instead of wowjs, because it is not working with import ... from 'wowjs'

and then tried the code you have provided.

when I run in my html
<h1 class="nomargin size-50 weight-300 wow rollIn" data-wow-delay="0.5s"> blah blah </h1> <p class="lead font-lato size-30 wow fadeInUp" data-wow-delay="0.7s"> blah blah </p>

the output is it has no animate, see the screenshot:

screen shot 2016-09-06 at 11 41 40 pm

@graphan
Copy link

graphan commented Sep 20, 2016

@graingert unfortunately, the code you mentioned does not work. Something changed?

@kaueburiti
Copy link

@graingert i have tried this code, but did not worked :/

@johhansantana
Copy link

any luck here?

@kaueburiti
Copy link

@JSantana90 i totally give up

@suncoastkid
Copy link

Same issue here...

@shealan
Copy link

shealan commented Jan 13, 2017

Same issue. Surely rather important as most developers are using NPM dependencies these days?

@badalsurana
Copy link

same issue here, anyone found any solution?

@interphased
Copy link

Not sure if this helps, but I got it to work using require and adding it to window.

bootstrap.js

const WOW = require('wowjs');

window.wow = new WOW.WOW({
    live: false
});

whatever.js

window.wow.init();

@ruchernchong
Copy link

new WOW.WOW().init();

in your HTML file works instead of having to place it in your app.js to compile.

@adammoisa
Copy link

This didn't work either. I used new WOW.WOW().init() but it still doesn't work. I can see in the rendered html that the animated class is indeed being added, but the animation doesn't run.

@ruchernchong
Copy link

@adammoisa Did you import WOW in anywhere of your scripts?

@Steven-Garcia
Copy link

I'm getting the same problem, it used to work fine with this line in the controller: new WOW().init(); and importing the script in the index.html, now I get the same error and it just won't work at all

@adammoisa
Copy link

@Ruchern yes of course. As I said it adds the animated class to the HTML which I think implies the package is 'working' to some degree...

@ruchernchong
Copy link

ruchernchong commented May 18, 2017

@adammoisa I'm sorry. I did not mean that.

Do you have window.WOW = require('wowjs')?

Try either window.WOW or window.WOW() I cannot remember which one I tried before. Ever since moving to UIKit, I took WOW out.

@gaboesquivel
Copy link

the module exports an object, the WOW constructor function is inside the returned object.

const WOW = require('wowjs').WOW

@xHeinrich
Copy link

window.WOW = require('wowjs').WOW worked for me

@ruchernchong
Copy link

import { WOW } from 'wowjs'
window.WOW = WOW

Perhaps this might work too.

@Sydney-o9
Copy link

With require

const {WOW} = require('wowjs');

@TanvirAmi
Copy link

TanvirAmi commented Jan 28, 2018

To Leverage Undefined Values make sure that your DOMm is ready and likely when a dependent variable is not defined. When the page is loaded and ready, and likely when a dependent variable is already defined.
For this use $(document).ready(function() { if ($.fn.init) { new WOW().init(); } });

@jhoanborges
Copy link

window.WOW = require('wowjs').WOW worked for me

This works like a charm

@mugianto
Copy link

window.WOW = require('wowjs').WOW worked for me

Thanks bro this work for me

@766
Copy link

766 commented May 25, 2019

Not sure if this helps, but I got it to work using require and adding it to window.

bootstrap.js

const WOW = require('wowjs');

window.wow = new WOW.WOW({
    live: false
});

whatever.js

window.wow.init();

Thanks bro this work for me

@vipertecpro
Copy link

vipertecpro commented Aug 26, 2020

window.WOW = require('wowjs').WOW;

  function wowAnimation() {
    new WOW({
      boxClass:   'wow',
      animateClass: 'animated',
      offset: 0,
      mobile: true
    }).init();
  }

  wowAnimation();

@kshvab
Copy link

kshvab commented Jul 16, 2022

React + Next js + typescript Works fine:

useEffect(() => {
        const WOW = require("wowjs/dist/wow.js");
        if (typeof window !== "undefined") {
            (window as any).WOW = WOW;
        }

        new WOW.WOW().init();
    }, []);

@veraLX
Copy link

veraLX commented Jul 16, 2022 via email

@Aaryan6
Copy link

Aaryan6 commented Mar 18, 2023

Try this, It works for me

// import wowjs if window is not undefined

const isServer = typeof window === "undefined";
const WOW = !isServer ? require("wowjs") : null;

// then write this code in the function

useEffect(() => {
    new WOW.WOW().init();
  }, []);

I hope this is useful ; )

@harapeko
Copy link

harapeko commented Apr 21, 2023

it works for me : )

  • "@sveltejs/kit": "1.15.2",
  • "wow.js": "^1.2.2" (not wowjs)
npm i --save wow.js
import { onMount } from 'svelte'

onMount(async () => {
	import('wow.js').then((WOW) => {
		new WOW.default().init()
	})
})

or

onMount(async () => {
	const wow = await import('wow.js')
	new wow.default().init()
})

@Cayllen
Copy link

Cayllen commented May 15, 2023

#252 (comment)
Harepo how does it work for you with sveltekit? I have it implemented but none of the animations work. Did you do have to do some extra work to make it work?

@nelson1995
Copy link

I found a better way to do it and it works.

Currently I’m using

  • “vue” : “3.3.4”
  • “wow.js” : ”1.2.2”
  • “ animate.css”: “4.1.1”
  1. Install wow.js

    npm install wow.js
    
  2. In your SFC or *.vue file add this

    onMounted(async () => {
      const wow = await import(‘wow.js’)
      new wow.default().init()
    }
    
  3. In your template add the wow class to any HTML tag element like this

    <template>
      <div class=“wow fadeInUp”></div>
    </template>
    

@veraLX
Copy link

veraLX commented Aug 21, 2023 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests