expanding info card - Download Expanding Info Card With jQuery And CSS/CSS3

Download Expanding Info Card With jQuery And CSS/CSS3

Posted on

This time I will share jQuery Plugin and tutorial about Expanding Info Card With jQuery And CSS/CSS3, hope it will help you in programming stack.

expanding info card - Download Expanding Info Card With jQuery And CSS/CSS3
File Size: 3.5 KB
Views Total: 775
Last Update:
Publish Date:
Official Website: Go to website
License: MIT
   

A pretty nice card interaction design that expands the info button into a modal-style, full-size info box using jQuery and CSS3 transitions & transforms.

How to use it:

1. Insert an info box into your card.

1 <div class="card">
2   <div class="hint">
3     <span class="icon-info"></span>
4   </div>
5 </div>

2. The core CSS for the card & info box.

01 .card {
02   position: relative;
03   width: 240px;
04   height: 180px;
05   border-radius: 12px;
06   background: #fff;
07   box-shadow: 0 12px 48px -8px rgba(0,0,0,0.1);
08 }
09  
10 .card .hint {
11   position: absolute;
12   top: -12px;
13   right: -12px;
14   width: 32px;
15   height: 32px;
16   background: #000;
17   border-radius: 16px;
18   transition: all 0.2s ease;
19 }
20  
21 .card .hint.show {
22   width: calc(100% + 24px);
23   height: calc(100% + 24px);
24 }
25  
26 .card .hint.show .icon-info:before {
27   transform: translate(15px, 10px) rotate(-45deg);
28 }
29  
30 .card .hint.show .icon-info:after {
31   transform: translate(15px, 10px) rotate(45deg);
32 }

3. The CSS for the info button.

01 .card .hint .icon-info {
02   position: absolute;
03   z-index: 1;
04   top: 0;
05   right: 0;
06   display: block;
07   width: 32px;
08   height: 32px;
09   border-radius: 16px;
10   cursor: pointer;
11   pointer-events: auto;
12 }
13  
14 .card .hint .icon-info:before,
15 .card .hint .icon-info:after {
16   content: '';
17   position: absolute;
18   width: 2px;
19   height: 12px;
20   background: #fff;
21   border-radius: 2px;
22   transform-origin: center center;
23   transition: all 0.25s ease;
24 }
25  
26 .card .hint .icon-info:before {
27   transform: translate(15px, 6px) rotate(0) scale(1, 0.2);
28 }
29  
30 .card .hint .icon-info:after {
31   transform: translate(15px, 12px) rotate(0) scale(1, 0.5);
32 }

4. Include the necessary jQuery JavaScript library on the page.

1 <script src="/path/to/jquery.slim.min.js"></script>

5. The jQuery script to toggle the CSS class when the user clicks on the info button.

1 $('.hint').click(function() {
2   $(this).toggleClass("show");
3 });

This awesome jQuery plugin is developed by Andreas Storm. For more Advanced Usages, please check the demo page or visit the official website.

source : jquery.net