回転寿司vol.2
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 |
<style> * { box-sizing: border-box; list-style: none; padding: 0; margin: 0; } body { padding: 30px 50px; } h1 { margin-bottom: 100px; } h2 { margin-bottom: 50px; } /* スライドする要素 */ .content { width: 300px; height: 300px; } .wrap { overflow: hidden; display: flex; align-items: center; height: 340px; margin-bottom: 100px; } .slideshow { display: flex; -webkit-animation: loop-slide 20s infinite linear 1s both; animation: loop-slide 20s infinite linear 1s both; } @-webkit-keyframes loop-slide { from { transform: translateX(0); } to { transform: translateX(-100%); } } @keyframes loop-slide { from { transform: translateX(0); } to { transform: translateX(-100%); } } .content-hover { transition: all 0.2s; margin-right: 20px; } .content-hover:hover { transform: translateY(-20px); border-radius: 0 10%; box-shadow: 0 3px 10px 0 #333; opacity: 0.8; cursor: pointer; } </style> |
以下のコードをbodyに挿入してみよう。
1 2 3 4 5 6 7 8 9 10 11 12 |
<h1>回転寿司</h1> <h2>好きなネタはどれかな?</h2> <div class="wrap slide-paused" ontouchstart=""> <ul class="slideshow"><!-- 以下 リピート3回-------------------> <li class="content content-hover"><img src="s01.jpg"></li> <li class="content content-hover"><img src="s01.jpg"></li> <li class="content content-hover"><img src="s01.jpg"></li> <li class="content content-hover"><img src="s01.jpg"></li> </ul> </div><!------slide-pausedここまで-------------> |