jeudi 27 avril 2017

Can't get this statement to work

I would like my element to show with position fixed only when offset().top is bigger than 300 px

Here is my code

$(window).scroll(function()
   {   
        if ( $(window).offset().top > 300)

            {
                $(".uparrow").css('position','fixed');
                 }
        else 
        {
            if ( $(window).offset().top < 300)


            {
                $(".uparrow").css('display','none');
            }
        }
    })

Aucun commentaire:

Enregistrer un commentaire