Make widgets left and right in one place while the user scrolls the page using space bar

I have a webpage with a large height attribute that displays products. I want the user to press the spacebar to move the page down to view more products, but I need my screen widgets (cart and categories) left and right to stay in the same place on the screen. And I do not want to use scrollbars. I assume this is a javascript request, can someone please tell me a good resource for this?

+3
source share
2 answers

There is no reason to use JavaScript - CSS should do. Using position: fixed, you can fix the elements on your page so that they are always in a certain position relative to the user's viewing window. An example probably illustrates this in the best way: http://www.jsfiddle.net/yijiang/qtkss/

Further reading:

+4
source

javascript, position: fixed; CSS top, bottom, left right . , HTML.

+2

Source: https://habr.com/ru/post/1779918/


All Articles