Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions dist/wow.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
interface WOWOptions {
boxClass?: string;
animateClass?: string;
offset?: number;
mobile?: boolean;
live?: boolean;
callback?: (box: HTMLElement) => void;
scrollContainer?: string | null;
}

declare class WOW {
constructor(options?: WOWOptions);
init(): void;
start(): void;
stop(): void;
sync(element?: Node): void;
show(box: HTMLElement): HTMLElement;
}

export default WOW;
export { WOW, WOWOptions };
23 changes: 10 additions & 13 deletions dist/wow.js
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,9 @@

})());

getComputedStyle = this.getComputedStyle || function(el, pseudo) {
this.getPropertyValue = function(prop) {
getComputedStyle = (typeof window !== "undefined" && window.getComputedStyle) || function(el, pseudo) {
var obj = {};
obj.getPropertyValue = function(prop) {
var ref;
if (prop === 'float') {
prop = 'styleFloat';
Expand All @@ -152,7 +153,7 @@
}
return ((ref = el.currentStyle) != null ? ref[prop] : void 0) || null;
};
return this;
return obj;
};

getComputedStyleRX = /(\-([a-z]){1})/g;
Expand Down Expand Up @@ -308,7 +309,7 @@

WOW.prototype.show = function(box) {
this.applyStyle(box);
box.className = box.className + " " + this.config.animateClass;
box.classList.add(this.config.animateClass);
if (this.config.callback != null) {
this.config.callback(box);
}
Expand Down Expand Up @@ -359,7 +360,7 @@
var target;
if (event.type.toLowerCase().indexOf('animationend') >= 0) {
target = event.target || event.srcElement;
return target.className = target.className.replace(this.config.animateClass, '').trim();
return target.classList.remove(this.config.animateClass);
}
};

Expand Down Expand Up @@ -414,22 +415,18 @@
WOW.prototype.vendorCSS = function(elem, property) {
var j, len, ref, result, style, vendor;
style = getComputedStyle(elem);
result = style.getPropertyCSSValue(property);
result = style.getPropertyValue(property);
ref = this.vendors;
for (j = 0, len = ref.length; j < len; j++) {
vendor = ref[j];
result = result || style.getPropertyCSSValue("-" + vendor + "-" + property);
result = result || style.getPropertyValue("-" + vendor + "-" + property);
}
return result;
};

WOW.prototype.animationName = function(box) {
var animationName, error;
try {
animationName = this.vendorCSS(box, 'animation-name').cssText;
} catch (error) {
animationName = getComputedStyle(box).getPropertyValue('animation-name');
}
var animationName;
animationName = this.vendorCSS(box, 'animation-name');
if (animationName === 'none') {
return '';
} else {
Expand Down
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"url" : "https://www.delac.io/"
},
"main": "./dist/wow.js",
"types": "./dist/wow.d.ts",
"repository" : {
"type" : "git",
"url" : "git://github.com/matthieua/WOW.git"
Expand Down