Skip to content

Commit

Permalink
v2.1.3 - Refactoring.
Browse files Browse the repository at this point in the history
  • Loading branch information
iDev-Games committed Apr 9, 2023
1 parent f14c60f commit f3d8d75
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 15 deletions.
2 changes: 1 addition & 1 deletion dist/trig.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "trig-js",
"version": "2.1.2",
"version": "2.1.3",
"description": "The easy way to create CSS scroll animations that react to the position of your HTML element on screen. Animate on scroll (AOS) your CSS.",
"main": "src/trig.js",
"scripts": {
Expand Down
32 changes: 19 additions & 13 deletions src/trig.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/* Trig.js v2.1.2 by iDev Games */
/* Trig.js v2.1.3 by iDev Games */
class Trig
{
trigs = [];
Expand Down Expand Up @@ -111,23 +111,29 @@ class Trig
}
trigSplit(split, index, cl){
var name = split;
if(split == 0 || split == 100){
trig.trigSplitEquals(name,split,cl,index);
} else {
trig.trigSplitMoreThan(name,split,cl,index);
}
}
trigSplitEquals(name,split,cl,index){
if(split == 0){
name = "top";
} else if(split == 100) {
name = "bottom";
}
if(split == 0 || split == 100){
if(trig.thePos[index] == split){
cl.add("trig-scroll-"+name);
} else {
cl.remove("trig-scroll-"+name);
}
} else {
if(trig.thePos[index] >= split){
cl.add("trig-scroll-"+name);
} else if(trig.thePos[index] < split) {
cl.remove("trig-scroll-"+name);
}
if(trig.thePos[index] == split){
cl.add("trig-scroll-"+name);
} else {
cl.remove("trig-scroll-"+name);
}
}
trigSplitMoreThan(name,split,cl,index){
if(trig.thePos[index] >= split){
cl.add("trig-scroll-"+name);
} else if(trig.thePos[index] < split) {
cl.remove("trig-scroll-"+name);
}
}
updatePos(element) {
Expand Down

0 comments on commit f3d8d75

Please sign in to comment.