"card"
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/martin-banks/pen/dOdpNZ?depth=everything&order=popularity&page=25&q=react&show_forks=false" /> <style class="cp-pen-styles">*{ transition: all 0.2s ease-in-out 0s } .card { position: relative; width: 300px; height: 300px; margin: 40px auto; } .image, .shadow { position: absolute; width: 100%; height: 100%; background-position: center; background-repeat: no-repeat; background-size: 105%; border-radius: 8px; background-color: #eee; } .shadow { transform: scale(0.9) translateY(30px); -webkit-filter: blur(25px); filter: blur(25px); background-color: rgba(0,0,0,0.3); } .shadowImage { position: absolute; width: 100%; height: 100%; opacity: 0.8; } .card:hover{ transform: scale(1.04) translateY(-5px); } .card:hover .image, .card:hover .shadow { background-size: 103%; } .card:hover .shadow { transform: scale(0.85) translateY(40px); -webkit-filter: blur(30px); filter: blur(30px); } button{ position: relative; margin: 0 auto; left: 50%; transform: translate3d(-50%, 0,0) }</style></head><body> <div id="app"></div> <script src='//production-assets.codepen.io/assets/common/stopExecutionOnTimeout-b2a7b3fe212eaa732349046d8416e00a9dec26eb7fd347590fbced3ab38af52e.js'></script><script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.3.1/react.min.js'></script><script src='https://cdnjs.cloudflare.com/ajax/libs/react/15.3.1/react-dom.min.js'></script> <script >"use strict"; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _possibleConstructorReturn(self, call) { if (!self) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return call && (typeof call === "object" || typeof call === "function") ? call : self; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) Object.setPrototypeOf ? Object.setPrototypeOf(subClass, superClass) : subClass.__proto__ = superClass; } var imageName = function imageName(image) { return { backgroundImage: "url(https://unsplash.it/200/300/?" + image + ")" }; }; var ChangeImageButton = function (_React$Component) { _inherits(ChangeImageButton, _React$Component); function ChangeImageButton() { _classCallCheck(this, ChangeImageButton); return _possibleConstructorReturn(this, _React$Component.apply(this, arguments)); } ChangeImageButton.prototype.render = function render() { return React.createElement( "button", { onClick: this.props.handleClick }, this.props.text ); }; return ChangeImageButton; }(React.Component); var Card = function (_React$Component2) { _inherits(Card, _React$Component2); function Card() { _classCallCheck(this, Card); var _this2 = _possibleConstructorReturn(this, _React$Component2.call(this)); _this2.state = { imageNumber: 'image=881' }; _this2.changeImage = _this2.changeImage.bind(_this2); _this2.chooseRandom = _this2.chooseRandom.bind(_this2); return _this2; } Card.prototype.chooseRandom = function chooseRandom() { return Math.floor(Math.random() * 1000) + 300; }; Card.prototype.changeImage = function changeImage() { this.setState({ imageNumber: "image=" + this.chooseRandom() }); }; Card.prototype.render = function render() { console.log(this.state.imageNumber); return React.createElement( "div", null, React.createElement( "div", { className: "card" }, React.createElement( "div", { className: "shadow" }, React.createElement("div", { className: "shadowImage", style: imageName(this.state.imageNumber) }) ), React.createElement("div", { className: "image", style: imageName(this.state.imageNumber) }) ), React.createElement(ChangeImageButton, { handleClick: this.changeImage, text: "Randomise image" }) ); }; return Card; }(React.Component); ReactDOM.render(React.createElement(Card, null), document.getElementById('app')); //# sourceURL=pen.js </script> </body></html>

Related: See More


Questions / Comments: