布局框架

炫酷文章缩略图卡片UI界面设计

阿里云


这是一款效果非常炫酷的网站列表页文章卡片 UI 界面设计效果,该文章卡片中包含了文章的缩略图、标题、文章简介等内容。文章的简介默认是不可见的,当鼠标滑过卡片时,缩略图被缩小,文章简介内容随之滑动显示出来。

HTML 结构

该文章卡片的 HTML 结构如下:

也想出现在这里?联系我们
创客主机
  1. <div class='column'>
  2.   <div class='post-module'>
  3.     <!--缩略图-->
  4.     <div class='thumbnail'>
  5.       <img src='img/demo.jpg'>
  6.     </div>
  7.     <div class='post-content'>
  8.       <div class='category'>文章类别</div>
  9.       <h1 class='title'>文章标题</h1>
  10.       <h2 class='sub_title'>文章子标题</h2>
  11.       <p class='description'>文章简介......</p>
  12.       <div class='post-meta'>
  13.         <span class='timestamp'>
  14.           <i class='fa fa-clock-o'></i>
  15.           6 分钟前
  16.         </span>
  17.         <span class='comments'>
  18.           <i class='fa fa-comments'></i>
  19.           <a href='#'>39 回复</a>
  20.         </span>
  21.       </div>
  22.     </div>
  23.   </div>
  24. </div>

CSS 样式

在鼠标滑过卡片的时候,卡片容器的阴影会发生动画效果,阴影被放大,就像卡片要脱离出屏幕一样。

  1. .post-module {
  2.   position: relative;
  3.   z-index: 1;
  4.   display: block;
  5.   background: #ffffff;
  6.   min-width: 270px;
  7.   height: 470px;
  8.   -webkit-box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.15);
  9.   -moz-box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.15);
  10.   box-shadow: 0px 1px 2px 0px rgba(0, 0, 0, 0.15);
  11.   -webkit-transition: all 0.3s linear 0s;
  12.   -moz-transition: all 0.3s linear 0s;
  13.   -ms-transition: all 0.3s linear 0s;
  14.   -o-transition: all 0.3s linear 0s;
  15.   transition: all 0.3s linear 0s;
  16. }
  17. .post-module:hover,
  18. .hover {
  19.   -webkit-box-shadow: 0px 1px 35px 0px rgba(0, 0, 0, 0.3);
  20.   -moz-box-shadow: 0px 1px 35px 0px rgba(0, 0, 0, 0.3);
  21.   box-shadow: 0px 1px 35px 0px rgba(0, 0, 0, 0.3);
  22. }

然后在鼠标滑过卡片的时候,缩略图被放大 1.1 倍,透明度降低为 0.6。

  1. .post-module .thumbnail img {
  2.   display: block;
  3.   width: 120%;
  4.   -webkit-transition: all 0.3s linear 0s;
  5.   -moz-transition: all 0.3s linear 0s;
  6.   -ms-transition: all 0.3s linear 0s;
  7.   -o-transition: all 0.3s linear 0s;
  8.   transition: all 0.3s linear 0s;
  9. }
  10. .post-module:hover .thumbnail img,
  11. .hover .thumbnail img {
  12.   -webkit-transform: scale(1.1);
  13.   -moz-transform: scale(1.1);
  14.   transform: scale(1.1);
  15.   opacity: .6;
  16. }

默认的文章简介部分 p.description 设置为 display: none;,是不可见的。后面在鼠标滑过卡片的时候,会使用一些 jQuery 代码来切换它的可见性。

  1. .post-module .post-content .description {
  2.   display: none;
  3.   color: #666666;
  4.   font-size: 14px;
  5.   line-height: 1.8em;
  6. }

JavaScript

为了切换文章简介部分的可见性和高度,这里使用了 jQuery 的 animate()方法。在鼠标滑过卡片的时候,代码从.post-module 包装集中查找.description 元素,并在 300 毫秒的时间内切换它的高度和可见性。

  1. $(window).load(function () {
  2.     $('.post-module').hover(function () {
  3.         $(this).find('.description').stop().animate({
  4.             height: 'toggle',
  5.             opacity: 'toggle'
  6.         }, 300);
  7.     });
  8. });

炫酷文章缩略图卡片 UI 界面设计

已有 433 人购买
查看演示升级 VIP立刻购买

演示地址 下载地址
收藏
(0)

发表回复

热销模板

Ashade - 作品展示摄影相册WordPress汉化主题
LensNews

本站承接 WordPress / PbootCMS / DedeCMS 等
系统建站、仿站、开发、定制等业务!