Hi, how can I move the logo from the top left corner to the center when I start scrolling. Thanks

I want to know how to move the logo from the top left corner to the center when I start scrolling. Thanks!

Asked on July 16, 2020 in CSS.
Add Comment
1 Answer(s)
  1. Have a onscroll event on the html element you want to scroll;
  2. Inside onscroll event handling change the style of logo element to align:center;

something like below(psuedo code):

<div onscroll="handleMyScrolling(event)">  <logo id="logo"></logo>   </div>   <script>  function handleMyScrolling(event){    document.getElementById('logo').style= // your style to bring the element to     center.  } </script> 
Answered on July 16, 2020.
Add Comment

Your Answer

By posting your answer, you agree to the privacy policy and terms of service.