lundi 14 septembre 2020

How can I make an offsen when I use fixed position of header?

At the moment I am working on web-site. It has a fixed position of header. I wrote the script, that allow me scroll to desired block, when I click the button. At the moment I have a probleb, my header coloses part of block. I have to make an offset that meet the header height, but I don't know how to do it.

   var butn = document.getElementById("btn");
    var dp = document.getElementById("skills");

    function scrollInSkills(){
        dp.scrollIntoView({
            behavior: "smooth",
            block: "start"
        })
    }
    butn.addEventListener("click", scrollInSkills)



Aucun commentaire:

Enregistrer un commentaire