H5仿微信界面教程(一)

前言 

先來張圖,仿微信界面,界面以下,並不徹底如出一轍,只能說有些相似,但願你們見諒。javascript

1 用到的知識點

jQuery WeUI 是WeUI的一個jQuery實現版本,除了實現了官方插件以外,它還提供了以下拉刷新、日曆、地址選擇器等豐富的拓展組件。jQuery WeUI 中的JS組件均是以JQuery 插件的形式提供,使用很是方便,而且能夠和React、Angular、VUE之類的主流JS框架一塊兒使用。css

WeUI 是微信官方團隊針對微信提供的一個H5 UI庫,它只提供了一組CSS組件。jQuery WeUI 中使用的是官方WeUI的CSS代碼,並提供了jQuery/Zepto版本的API實現。由於直接使用了官方的CSS,因此你不用擔憂跟官方版本的衝突。實際上 jQuery WeUI == WeUI + jQuery插件。html

Font Awesome 是一套完美的圖標字體,主要目的是和 Bootstrap 搭配使用。java

2 引入樣式文件

  <link href="static/lib/weui.css" rel="stylesheet" type="text/css" /> 
  <link href="static/css/jquery-weui.css" rel="stylesheet" type="text/css" /> 
  <link href="static/font-awesome/css/font-awesome.css" rel="stylesheet" type="text/css" /> 

 3 先說底部菜單

<div class="weui-tabbar"> 
<a href="wx-wx.html" class="weui-tabbar__item "> <span class="weui-badge" style="position: absolute;top: -.4em;right: 1em;">8</span> 
<div class="weui-tabbar__icon"> 
<i class="fa fa-comment-o fa-fw" style=" "></i> 
</div> <p class="weui-tabbar__label">微信</p> </a> 
<a href="wx-tongxulv.html" class="weui-tabbar__item"> 
<div class="weui-tabbar__icon"> 
<i class="fa fa-vcard-o" style=" "></i> 
</div> <p class="weui-tabbar__label">通信錄</p> </a> 
<a href="#tab3" class="weui-tabbar__item"> 
<div class="weui-tabbar__icon"> 
<i class="fa fa-compass " style=""></i> 
</div> <p class="weui-tabbar__label">發現</p> </a> 
<a href="wx-user.html" class="weui-tabbar__item weui-bar__item--on"> 
<div class="weui-tabbar__icon"> 
<i class="fa fa-user" style=" color:#0dba08;"></i> 
</div> <p class="weui-tabbar__label" style=" color:#0dba08;"></p> </a> 
</div>

 4 頭部代碼

  <nav class="blue nav" style=" "> 
   <a  id="topPopovershow" href="#" class="button button-link right "> <i class="fa fa-plus fa-fw" style=" font-size:20px;" ></i> </a>   
   <h1 class="title">微信</h1> 
  </nav> 

 5 主體部分

 <div class="page-content">  
            <div class="weui-cells" style="margin-top: 0px;">
                 <a class="weui-cell weui-cell_access open-popup  weui-popup-modal "  data-target="#full"  href="javascript:;">
            <div class="weui-cell__hd">
            <img width="48px;" class="weui-media-box__thumb" src="images/timg5.jpg" alt="" class="self-header">
        </div>
            <div class="weui-cell__bd">
                <div style=" margin-left:10px;">
    
      <h4 class="weui-media-box__title">小樓聽春雨菩提本無樹</h4>
      <p class="weui-media-box__desc" >菩提本無樹,明鏡</p>

            </div>  
            </div>
            <div class="weui-cell__ft">22:55</div>
          </a>
          
               <a class="weui-cell weui-cell_access" href="javascript:;">
            <div class="weui-cell__hd">
            <img width="48px;" class="weui-media-box__thumb" src="images/timg2.jpg" alt="" class="self-header">
        </div>
            <div class="weui-cell__bd">
                <div style=" margin-left:10px;">
    
      <h4 class="weui-media-box__title">聽春雨</h4>
      <p class="weui-media-box__desc" >你們聊聊天今天下雨了</p>

            </div>  
            </div>
            <div class="weui-cell__ft">22:55</div>
          </a>
</div>

 6 頭部css

.nav {
 position: fixed;
    right: 0;
    left: 0;
    z-index: 10;
    height: 2.2rem;
    padding-right: .5rem;
    padding-left: .5rem;
    background-color: #0993c7;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    color: #FFF;
    background-color: #20a0ff;
} 
相關文章
相關標籤/搜索