Material Design vCard With jQuery And CSS3 - MCard
File Size: | 12.2 KB |
---|---|
Views Total: | 3118 |
Last Update: | |
Publish Date: | |
Official Website: | Go to website |
License: | MIT |
MCard is a small jQuery & CSS flexbox based vCard generator to create responsive, Material Design inspired Personal Social/Contact Card on the web page.
How to use it:
1. Insert your profile information into the vCard following the html structure like this:
<div class="card"> <div class="right"></div> <div class="left"> <div class="content"> <h1 class="name">jQuery Script</h1> <h2 class="title">A jQuery Plugin Website</h2> <h3 class="status">https://www.jqueryscript.net</h3> </div> <div class="action"> <a class="icon twitter" href="https://twitter.com/jqueryscript"><span></span> <div class="ripple"></div> </a> <a class="icon github" href="https://github.com/jqueryscript"><span></span> <div class="ripple"></div> </a> <a class="icon codepen" href="#"><span></span> <div class="ripple"></div> </a> <a class="icon telegram" href="#"><span></span> <div class="ripple"></div> </a> </div> </div> </div>
2. The primary CSS styles for the vCard.
.card { flex-basis: 50ex; flex-grow: 0; flex-shrink: 1; border: 0; border-radius: 0.25ex; display: flex; background-color: #fff; box-shadow: 0 1px 3px rgba(0,0,0,0.12), 0 1px 2px rgba(0,0,0,0.24); } .right { flex: 1.4; flex-grow: 1.4; flex-shrink: 1.4; background-color: #888; border: 0; border-radius: 0 0.25ex 0.25ex 0; background: url(../images/Avatar.jpg) no-repeat -1.5ex top local; background-size: cover; } .left { flex: 3; flex-grow: 3; flex-shrink: 3; display: flex; flex-direction: column; align-items: flex-start; justify-content: space-between; } .content { flex: 2; flex-shrink: 2; flex-grow: 2; flex-basis: 14ex; font-family: 'Roboto'; padding-left: 3ex; } .name { font-size: 18pt; font-family: 'Roboto'; font-weight: 500; line-height: 2ex; } .title { font-size: 11pt; font-family: 'Roboto'; font-weight: 500; line-height: 1.5ex; color: #666; } .status { font-size: 10pt; font-family: 'Roboto'; font-weight: 500; line-height: 4ex; color: #444; } .action { flex: 1; flex-shrink: 1; flex-grow: 1; flex-basis: 7ex; width: 100%; display: flex; align-items: center; justify-content: space-around; border-top: 1px solid #eee; } .icon { font-family: FontAwesome; font-size: 18pt; flex: 1; flex-shrink: 1; flex-grow: 1; color: #aaa; cursor: pointer; text-align: center; padding: 0.4ex 0; background-color: #fff; transition: 0.25s; overflow: hidden; position: relative; text-decoration: none; } .icon:hover { background-color: #eee; border: 0; border-radius: 0.2ex; transition: 0.25s; } .telegram { margin-right: 1ex; color: #0088cc; } .github { color: #333; } .codepen { color: #0ebeff; } .twitter { color: #1da1f2; margin-left: 1ex; }
3. Activate the ripple click effect. (Requires jQuery).
<script src="https://code.jquery.com/jquery-3.2.1.min.js" integrity="sha256-hwg4gsxgFZhOsEEamdOYGBf13FyQuiTwlAQgxVSNgt4=" crossorigin="anonymous"></script>
.ripple { position: absolute; top: 50%; left: 50%; width: 5px; height: 5px; background: rgba(255, 255, 255, .5); opacity: 0; border-radius: 100%; transform: scale(1, 1) translate(-50%); transform-origin: 50% 50%; } @keyframes ripple { 0% { transform: scale(0, 0); opacity: 1; } 20% { transform: scale(25, 25); opacity: 1; } 100% { opacity: 0; transform: scale(40, 40); } }
$('body').on('click', '.icon', function() { var element = $(this).children().last(); console.log(element); element.css('animation', 'ripple 1s ease-out'); setTimeout(function() { element.css('animation', ''); }, 1000); });
This awesome jQuery plugin is developed by iMasoud. For more Advanced Usages, please check the demo page or visit the official website.