Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

WOW is not a constructor

when I try to require WOW by one of those statements

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

I receive this error

jQuery.Deferred exception: WOW is not a constructor TypeError: WOW is not a constructor

like image 454
Ali Turki Avatar asked Apr 13 '17 12:04

Ali Turki


People also ask

Is not a constructor error?

The JavaScript exception "is not a constructor" occurs when there was an attempt to use an object or a variable as a constructor, but that object or variable is not a constructor.


2 Answers

try this one

const WOW = require('wowjs');

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

window.wow.init();
like image 123
Ashraf Farhan Avatar answered Oct 16 '22 06:10

Ashraf Farhan


the module exports an object, you need to use the WOW constructor in that object. Eg. require('wowjs').WOW

like image 39
Gabo Esquivel Avatar answered Oct 16 '22 06:10

Gabo Esquivel