3 ms·
I use this often. However I sometimes want the sticky part to stay where it initially rendered on the page, like a nav bar. Perhaps I don't know enough CSS but
by cercatrova 4y ago
I use this often. However I sometimes want the sticky part to stay where it initially rendered on the page, like a nav bar. Perhaps I don't know enough CSS but anyone know how I can do that?
- redweer 4y agoreplace `position: sticky` with `position: relative`
- Avery3R 4y agoThere's static ding that'll make turn the sticky/floating elements into normal ones https://www.staticding.org/ https://www.staticding.org/ it does put a little overlay telling you how many elements it adjusted, but you can remove that with a couple modified lines in the source.
- dekatron 4y agoJust replace the `node.parentNode.removeChild(node);` line with `node.style['position'] = 'static';`. With this, you can 'un-sticky' the element instead of removing it. Here's the URL-encoded bookmarklet code with the above change: javascript:(function()%7Bdocument.querySelectorAll('body%20*').forEach(function(node)%20%7Bif%20(%5B'fixed'%2C%20'sticky'%5D.includes(getComputedStyle(node).position))%20%20%7Bnode.style%5B'position'%5D%20%3D%20'static'%3B%7D%7D)%3Bdocument.querySelectorAll('html%20*').forEach(function(node)%20%7Bvar%20s%20%3D%20getComputedStyle(node)%3Bif%20('hidden'%20%3D%3D%3D%20s%5B'overflow'%5D)%20%7B%20node.style%5B'overflow'%5D%20%3D%20'visible'%3B%20%7Dif%20('hidden'%20%3D%3D%3D%20s%5B'overflow-x'%5D)%20%7B%20node.style%5B'overflow-x'%5D%20%3D%20'visible'%3B%20%7Dif%20('hidden'%20%3D%3D%3D%20s%5B'overflow-y'%5D)%20%7B%20node.style%5B'overflow-y'%5D%20%3D%20'visible'%3B%20%7D%7D)%3Bvar%20htmlNode%20%3D%20document.querySelector('html')%3BhtmlNode.style%5B'overflow'%5D%20%3D%20'visible'%3BhtmlNode.style%5B'overflow-x'%5D%20%3D%20'visible'%3BhtmlNode.style%5B'overflow-y'%5D%20%3D%20'visible'%7D)()