Made a slider menu on css3, but it doesn’t suit me how it works. In this form, the background is fixed with the help of fixed (otherwise it does not look like it should), but because of this, scrolling is impossible. I understand what needs to be done on js, but I’m not going to put my mind on it myself with js recently. Example link (in firefox not working yet)
* { margin: 0; padding: 0; box-sizing: border-box; } html, body { height: 100vh; } body { font: 16px/1 'Open Sans', sans-serif; background: #ddd; } .nav { position: relative; top: 50%; left: 50%; width: 650px; height: 400px; margin-top: -150px; margin-left: -330px; background: #fff; transform: translateZ(0); } .nav:hover .link { width: 5%; } .nav .link { position: relative; float: left; width: 14%; height: 100%; color: #aaa; border-right: 1px solid #ddd; transition: .5s width; overflow: hidden; } .nav .link:last-child { border-right: 0; } .nav .link:hover { width: 80%; color: #555; } .link1 { background: url('https://cdn.mashina.kg/tachka/images//a/2/3/a236caeb97c22a804cabc349d50630a2_1200x900.jpg') no-repeat fixed center; background-size: 600px; } .link2 { background: url('http://www.avtovzglyad.ru/media/article/470fe986b4955ce9faf8b06818c79f841bd73c.jpg.740x555_q85_box-0%2C0%2C1024%2C768_crop_detail_upscale.jpg') no-repeat fixed center; background-size: 600px; } .link3 { background: url('http://autodrop.ru/uploads/1353693314_mashina-v-kredit-bez-procentov.jpg') no-repeat fixed center; background-size: 600px; } .link4 { background: url('https://static.riafan.ru/uploads/2018/01/16/orig-15161241775df3417dd73a6a5155fc7394f4497d24.jpeg') no-repeat fixed center; background-size: 600px; } .link5 { background: url('../img/Side-Profile-2016-BMW-X6-white.png') no-repeat fixed center; background-size: 600px; } .link6 { background: url('https://www.conceptcarz.com/images/BMW/BMW-Limited-Edition-Individual-M6-manu-07_01.jpg') no-repeat fixed center; background-size: 600px; } .link7 { background: url('https://4.bp.blogspot.com/-ax9FhRp6CDA/WJZf8UNllfI/AAAAAAAACFQ/GmZyevgUmkQSBXD6catacpgw5CXaNZlNACLcB/s1600/3rabhard.com_1395505864_664.jpg') no-repeat fixed center; background-size: 600px; } <div class='nav link1'> <div class='link'></div> <div class='link link2'></div> <div class='link link3'></div> <div class='link link4'></div> <div class='link link5'></div> <div class='link link6'></div> <div class='link link7'></div> </div>
margin-left, but throughflex-growflex-srink, then there will be no scrolling, in theory. True picture, probably distorted. - Dmytryk