vendredi 17 août 2018

Else if multiple condition

I have a function that should be changing CSS if different conditions are met but can't get it to work:

            var innerWidth = window.innerWidth;
            if (innerWidth < 600){
                jQuery(".container li").css("width", "100%");
            } else if (600 < innerWidth && innerWidth > 900) {
                jQuery(".container li").css("width", "50%");
            } else (900 < innerWidth && innerWidth > 1200) {
                jQuery(".container li").css("width", "33%");
            }

I believe this is the condition inside of else if and else that is wrong.

What would be the correct way of achieving this output?

Aucun commentaire:

Enregistrer un commentaire