"card effect"
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 ----------> <div data-offset="5" class="card"> <div class="card-effect"></div> <div data-offset="1" class="layer-1"></div> <div data-offset="20" class="layer-2"></div> </div> <script> /** - Designed by: https://dribbble.com/ShaneHarris - https://dribbble.com/shots/2110771-Rebuild-Nepal */ "use strict"; var $card = $('.card'), $card_effect = $('.card-effect'), $layer = $('div[class*="layer-"]'), w = $(window).width(), //window width h = $(window).height(); //window height $(window).on('mousemove', function (e) { var offsetX = 0.5 - e.pageX / w, //cursor position X offsetY = 0.5 - e.pageY / h, //cursor position Y dy = e.pageY - h / 2, //@h/2 = center of poster dx = e.pageX - w / 2, //@w/2 = center of poster theta = Math.atan2(dy, dx), //angle between cursor and center of poster in RAD angle = theta * 180 / Math.PI - 90, //convert rad in degrees offsetPoster = $card.data('offset'), transformPoster = 'translateY(' + -offsetX * offsetPoster + 'px) rotateX(' + (-offsetY * offsetPoster) + 'deg) rotateY(' + (offsetX * (offsetPoster * 2)) + 'deg)'; //poster transform //get angle between 0-360 if (angle < 0) { angle = angle + 360; } //gradient angle and opacity $card_effect.css('background', 'linear-gradient(' + angle + 'deg, rgba(255,255,255,' + e.pageY / h + ') 0%,rgba(255,255,255,0) 80%)'); //poster transform $card.css('transform', transformPoster); //parallax foreach layer $layer.each(function () { var $this = $(this), offsetLayer = $this.data('offset') || 0, transformLayer = 'translateX(' + offsetX * offsetLayer + 'px) translateY(' + offsetY * offsetLayer + 'px)'; $this.css('transform', transformLayer); }); }); </script>
body, html { height: 100%; min-height: 100%; } body { background: -webkit-linear-gradient(top, #f6f7fc 0%, #d5e1e8 40%); background: linear-gradient(to bottom, #f6f7fc 0%, #d5e1e8 40%); -webkit-transform-style: preserve-3d; transform-style: preserve-3d; -webkit-transform: perspective(800px); transform: perspective(800px); } .card { width: 400px; height: 200px; position: absolute; top: 50%; left: 50%; margin: -100px 0 0 -200px; border-radius: 5px; box-shadow: 0 45px 100px rgba(0, 0, 0, 0.4); overflow: hidden; } .card .card-effect { position: absolute; top: 0; left: 0; right: 0; bottom: 0; background: -webkit-linear-gradient(315deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 60%); background: linear-gradient(135deg, rgba(255, 255, 255, 0.5) 0%, rgba(255, 255, 255, 0) 60%); z-index: 100; } .card div[class*="layer-"] { position: absolute; top: -10px; left: -10px; right: -10px; bottom: -10px; background-size: 100% auto; background-repeat: no-repeat; background-position: 0 0; -webkit-transition: 0.1s; transition: 0.1s; } .card .layer-1 { background-image: url("https://d13yacurqjgara.cloudfront.net/users/5197/screenshots/2110771/dribbble_-_rebuild_nepal.jpg"); background-position: 10px !important; } .card .layer-2 { background-image: url("http://gallery.yopriceville.com/var/albums/Free-Clipart-Pictures/Decorative-Elements-PNG/Rain_Effect_PNG_Picture.png?m=1399672800"); }

Related: See More


Questions / Comments: