jeudi 10 novembre 2016

Multiple conditions in "if else" statement

I'm trying to use multiple conditions in the if else statement, I would say: if the scroll-top is greater than 0 and .skiptranslate is visible do this ... of course my code does not work ... Any suggestions?

$(window).scroll(function(){
    if ($(window).scrollTop() > 0) {
        $('.header-main').css({
            "position" : "fixed",
            "top" : "0"
        }); 

    if else ($(window).scrollTop() > 0 && $('.skiptranslate').is(':visible')) {
        $('.header-main').css({
            "position" : "fixed",
            "top" : "39px"
        }); 

    } else {
        $('.header-main').css({
            "position" : "absolute",
            "top" : "0"
        });         
    }
});

Aucun commentaire:

Enregistrer un commentaire