CSS question classList.add in IE


#1

Hi,

i have a not so kirby related question: about JS/CSS:

i’ve converted a “scroll reveal” script from jQuery to vanillaJS BUT it want work in IE(10/11) browsers.

have a look: https://codepen.io/svnt/pen/ayEYoP

At line 61 in the JS i use a simple .classList.add to… add a class :wink: … no success on IE.

https://caniuse.com/#search=classList

Any idea what’s wrong? I’ve tested other demos/script with classList.add… they work.

Please halp :wink:

best regards,
Svnt


#2

Why reinvent the wheel? Plenty of scripts out there to do this. Like this one that looks like it uses classList. Maybe it give u a clue with your own script.


#3

True.

I tested some like reveal.js and whow.js but they depend on jQuery and are huuuge.

The one you found is really small indeed and also uses classList.add. Docs say: “works in IE10+” … then whyTF my one want?


#4

That’s true, but sometimes you want to create something yourself, if only to learn something? You don’t learn anything if you just use ready to use scripts. Especially if you’ve gone all the way to convert something and then fails, I’d like to find the issue as well.

Can’t help with this, I’m afraid.


#5

Sure, learning stuff is good, and I would probably wan’t to get to the bottom of it myself too… every day is a school day :slight_smile:


#6

@Svnt have you tried asking the same question on Stackoverflow?


#7

Not yet.
I know most of the answers beforehand… ‘use wow.js’, ‘use Jquery’, ‘use a polyfill’ or be bombed away by ‘duplicate’. :see_no_evil:
Maybe i’ll do it if i can’t find a clue but until now i’ve not given up on it (completely). :wink: It’s just a side spare time script… so no hurry.


#8

Hmm yeah, it’s easy to get shot down on Stackoverflow.

I know everyone forgets about Google+ but I have found them pretty helpful. Try asking in one of the Javascript communities.


#9

I see you also used Event. I’ve had problems with this as well in IE…

Might have a look to workaround this in IE too. Maybe this can help: https://stackoverflow.com/questions/26596123/internet-explorer-9-10-11-event-constructor-doesnt-work ?

good luck!