clickio

top sticky

May 24th, 2022 (edited)
34
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.80 KB | None | 0 0
  1. <style>
  2. header {height: 130px; position: fixed; z-index: 999; transition: all 0.5s}
  3. #top-sticky {width:320px;height:60px;}
  4. section:first-of-type {padding-top: 140px}
  5. #top-sticky ~ div {margin-top:10px}
  6. </style>
  7. <script>
  8. let lastPos=0,e=document.querySelector("header");e.style.top='0px';window.addEventListener("scroll",()=>{window.pageYOffset<lastPos?setTimeout(()=>{e.style.top="0px"},500):setTimeout(()=>{e.style.top="-60px"},500),lastPos=window.pageYOffset});
  9. </script>
  10.  
  11. <div id="top-sticky">
  12. <script async type='text/javascript' src='//s.clickiocdn.com/t/220192/360_light.js'></script>
  13. <script class='__lxGc__' type='text/javascript'>
  14. ((__lxGc__=window.__lxGc__||{'s':{},'b':0})['s']['_220192']=__lxGc__['s']['_220192']||{'b':{}})['b']['_695019']={'i':__lxGc__.b++};
  15. </script>
  16. </div>
Add Comment
Please, Sign In to add comment