Re:Kill-sticky, a bookmarklet to remove sticky elements and ...
by cercatrova on Tuesday September 27, 2022 @01:31PM
(#32998428)
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?
[ Parent
| on HN ]
Re:Kill-sticky, a bookmarklet to remove sticky elements and ...
by dekatron on Tuesday September 27, 2022 @03:41PM
(#33000138)
Just 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)()
Re:Kill-sticky, a bookmarklet to remove sticky elements and ...
by Avery3R on Tuesday September 27, 2022 @02:04PM
(#32998895)
There's static ding that'll make turn the sticky/floating elements into normal ones
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.