"mobile"
Bootstrap 3.0.0 Snippet by evarevirus

<link href="//netdna.bootstrapcdn.com/bootstrap/3.0.0/css/bootstrap.min.css" rel="stylesheet" id="bootstrap-css"> <script src="//netdna.bootstrapcdn.com/bootstrap/3.0.0/js/bootstrap.min.js"></script> <script src="//code.jquery.com/jquery-1.11.1.min.js"></script> <!------ Include the above in your HEAD tag ----------> <!DOCTYPE html><html class=''> <head><script src='//production-assets.codepen.io/assets/editor/live/console_runner-079c09a0e3b9ff743e39ee2d5637b9216b3545af0de366d4b9aad9dc87e26bfd.js'></script><script src='//production-assets.codepen.io/assets/editor/live/events_runner-73716630c22bbc8cff4bd0f07b135f00a0bdc5d14629260c3ec49e5606f98fdd.js'></script><script src='//production-assets.codepen.io/assets/editor/live/css_live_reload_init-2c0dc5167d60a5af3ee189d570b1835129687ea2a61bee3513dee3a50c115a77.js'></script><meta charset='UTF-8'><meta name="robots" content="noindex"><link rel="shortcut icon" type="image/x-icon" href="//production-assets.codepen.io/assets/favicon/favicon-8ea04875e70c4b0bb41da869e81236e54394d63638a1ef12fa558a4a835f1164.ico" /><link rel="mask-icon" type="" href="//production-assets.codepen.io/assets/favicon/logo-pin-f2d2b6d2c61838f7e76325261b7195c27224080bc099486ddd6dccb469b8e8e6.svg" color="#111" /><link rel="canonical" href="https://codepen.io/dovydas/pen/WRpBEp?depth=everything&order=popularity&page=14&q=translate&show_forks=false" /> <link rel='stylesheet prefetch' href='https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css'> <style class="cp-pen-styles">@import url("https://fonts.googleapis.com/css?family=Lato:100"); .scene { position: absolute; top: 0; right: 0; bottom: 0; left: 0; -webkit-perspective: 1000px; perspective: 1000px; overflow: hidden; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; font-family: 'Lato', sans-serif; background: #131315; } .canvas { position: absolute; top: 50%; left: 50%; width: 280px; height: 430px; -webkit-transform-origin: center center 0px; transform-origin: center center 0px; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%); -webkit-transform-style: preserve-3d; transform-style: preserve-3d; background: #28495B; } .canvas .poster { position: absolute; top: 0; bottom: 0; left: 0; right: 0; overflow: hidden; } .canvas .poster-title { position: absolute; width: 100px; left: 25px; bottom: 25px; font-weight: 100; color: rgba(255, 255, 255, 0.6); font-size: 40px; line-height: 45px; } .canvas div { position: absolute; -webkit-transform-style: preserve-3d; transform-style: preserve-3d; } .title { position: absolute; right: 0; font-weight: 100; font-size: 12px; color: white; -webkit-transform: translateX(120%); transform: translateX(120%); } .title .subtitle { margin-top: 10px; width: 110px; line-height: 17px; font-size: 9px; color: #bebebe; } .glass { position: absolute; width: 280px; height: 430px; -webkit-transform: translateZ(3px); transform: translateZ(3px); background-image: url("https://s3-us-west-2.amazonaws.com/s.cdpn.io/258608/room.png"); background-position: 0px 0px; opacity: 0.01; } .frame-left-inner { left: 0; width: 4px; height: 430px; -webkit-transform-origin: left bottom; transform-origin: left bottom; -webkit-transform: rotateY(-90deg); transform: rotateY(-90deg); background: #171717; } .frame-left-surface { right: 0; width: 5px; height: 430px; -webkit-transform-origin: right bottom; transform-origin: right bottom; -webkit-transform: rotateY(90deg); transform: rotateY(90deg); background: #242424; } .frame-left-outter { top: -5px; width: 15px; height: 440px; -webkit-transform-origin: left bottom; transform-origin: left bottom; -webkit-transform: rotateY(90deg); transform: rotateY(90deg); background: black; } .frame-right-inner { right: 0; width: 4px; height: 430px; -webkit-transform-origin: right bottom; transform-origin: right bottom; -webkit-transform: rotateY(90deg); transform: rotateY(90deg); background: black; } .frame-right-surface { left: 0; width: 5px; height: 430px; -webkit-transform-origin: left bottom; transform-origin: left bottom; -webkit-transform: rotateY(-90deg); transform: rotateY(-90deg); background: #242424; } .frame-right-outter { right: 0; top: -5px; width: 15px; height: 440px; -webkit-transform-origin: right bottom; transform-origin: right bottom; -webkit-transform: rotateY(-90deg); transform: rotateY(-90deg); background: #303030; } .frame-top-inner { right: 0; width: 280px; height: 4px; -webkit-transform-origin: right top; transform-origin: right top; -webkit-transform: rotateX(90deg); transform: rotateX(90deg); background: black; } .frame-top-surface { bottom: 0; left: -5px; width: 290px; height: 5px; -webkit-transform-origin: right bottom; transform-origin: right bottom; -webkit-transform: rotateX(-90deg); transform: rotateX(-90deg); background: #242424; } .frame-top-outter { width: 290px; height: 15px; -webkit-transform-origin: right top; transform-origin: right top; -webkit-transform: rotateX(-90deg); transform: rotateX(-90deg); background: #3d3d3d; } .frame-bottom-inner { bottom: 0; left: 0; width: 280px; height: 4px; -webkit-transform-origin: right bottom; transform-origin: right bottom; -webkit-transform: rotateX(-90deg); transform: rotateX(-90deg); background: #303030; } .frame-bottom-surface { top: 0px; left: -5px; width: 290px; height: 5px; -webkit-transform-origin: right top; transform-origin: right top; -webkit-transform: rotateX(90deg); transform: rotateX(90deg); background: #242424; } .frame-bottom-outter { bottom: 0; width: 290px; height: 15px; -webkit-transform-origin: right bottom; transform-origin: right bottom; -webkit-transform: rotateX(90deg); transform: rotateX(90deg); background: black; } </style></head><body> <div class="scene"> <div class="canvas"> <div class="poster"> <div class="poster-title">CSS GLASS</div> <svg viewbox="0 0 280 430" version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" style="background: #28495B"> <defs> <lineargradient id="linearGradient-1" x1="50%" y1="0%" x2="50%" y2="100%"> <stop stop-color="#CB1F3F" offset="0%"></stop> <stop stop-color="#000000" offset="100%"></stop> </lineargradient> <lineargradient id="linearGradient-2" x1="50%" y1="0%" x2="50%" y2="100%"> <stop stop-color="#B96EC4" offset="0%"></stop> <stop stop-color="#3B7292" offset="100%"></stop> </lineargradient> <lineargradient id="linearGradient-3" x1="95.0498057%" y1="2.12400981%" x2="62.2385825%" y2="78.884625%"> <stop stop-color="#50618C" offset="0%"></stop> <stop stop-color="#C75656" offset="100%"></stop> </lineargradient> </defs> <g stroke="none" stroke-width="1" fill="none" fill-rule="evenodd"> <rect fill="url(#linearGradient-1)" opacity="0.433537138" transform="translate(203.000000, 134.000000) rotate(27.000000) translate(-203.000000, -134.000000) " x="-44" y="-18" width="494" height="304"></rect> <rect fill="url(#linearGradient-2)" opacity="0.433537138" transform="translate(-28.764935, 151.332182) rotate(46.000000) translate(28.764935, -151.332182) " x="-317.764935" y="28.3321819" width="578" height="246"></rect> <rect fill="url(#linearGradient-3)" opacity="0.669610507" transform="translate(387.676103, 35.230771) rotate(513.000000) translate(-387.676103, -35.230771) " x="74.6761032" y="-50.2138834" width="626" height="170.889308"></rect> </g> </svg> </div> <div class="title">Hover/touch to rotate <div class="subtitle">Lorem ipsum dolor sit amet, consectetur adipiscing elit. Phasellus ut ornare ante. Vivamus semper ut orci ac vehicula. Nunc dictum dapibus faucibus. Curabitur sit amet interdum quam, at scelerisque tellus.</div> </div> <div class="glass"></div> <div class="frame-left-inner"> <div class="frame-left-surface"> <div class="frame-left-outter"></div> </div> </div> <div class="frame-right-inner"> <div class="frame-right-surface"> <div class="frame-right-outter"></div> </div> </div> <div class="frame-top-inner"> <div class="frame-top-surface"> <div class="frame-top-outter"></div> </div> </div> <div class="frame-bottom-inner"> <div class="frame-bottom-surface"> <div class="frame-bottom-outter"> </div> </div> </div> </div> </div> <script src='//production-assets.codepen.io/assets/common/stopExecutionOnTimeout-b2a7b3fe212eaa732349046d8416e00a9dec26eb7fd347590fbced3ab38af52e.js'></script> <script >(function() { var scene = document.getElementsByClassName('scene')[0]; var canvas = document.getElementsByClassName('canvas')[0]; var glass = document.getElementsByClassName('glass')[0]; try { document.createEvent("TouchEvent"); scene.addEventListener('touchmove', onTouchMove); } catch (e) { scene.addEventListener('mousemove', onMouseMove); } function onTouchMove(event) { event.preventDefault(); var x = event.touches[0].pageX; var y = event.touches[0].pageY; updateRotation(x, y); } function onMouseMove(event) { var x = event.x; var y = event.y; updateRotation(x, y); } function updateRotation(x, y) { var yAxisRotation = (x - (window.innerWidth / 2)) * (80 / window.innerWidth); var xAxisRotation = (y - (window.innerHeight / 2)) * (-80 / window.innerHeight); var transformations = [ 'translate(-50%, -50%)', 'rotateY(' + yAxisRotation + 'deg)', 'rotateX(' + xAxisRotation + 'deg)' ]; glass.style.backgroundPosition = (500 - yAxisRotation * 5 + 'px ') + (xAxisRotation * 5 + 'px'); canvas.style.transform = transformations.join(' '); }; })(); //# sourceURL=pen.js </script> </body></html>

Related: See More


Questions / Comments: