App下載

html5AmazeUI頂部導航條與側(cè)邊導航欄實現(xiàn)案例分析!步驟代碼分享!

叼著奶瓶去逛gai 2021-08-19 11:52:47 瀏覽數(shù) (2880)
反饋

今天和大家分享有關于“html5AmazeUI頂部導航條與側(cè)邊導航欄實現(xiàn)案例分析!”這方面的相關內(nèi)容分享,希望小編的分享對大家有所幫助!

頂部導航條如果你細心留意下現(xiàn)在的頁面,實在是太常見了。這個組件在手機端的頁面中,同樣可以借助AmazeUI這個前端框架實現(xiàn)。與此同時,可以在導航欄的最右方加一個觸發(fā)側(cè)邊導航欄offCanvas。不要再使用BootStrap那種,一旦點擊就大幅度下拉的導航了,反正我個人覺得很蛋疼的。一個導航活活地占據(jù)了頁面大量位置。這個側(cè)邊導航欄offCanvas曾經(jīng)是php方面的WorkPress的優(yōu)秀設計來的。

使用AmazeUI做出來的效果如下:


 

首先是頂部導航欄的代碼:

<!--這里的頂部導航欄與Bootstrap一種,也只提供深淺兩色。唯一不同的是,Bootstrap是灰黑兩色,AmazeUI則是灰藍兩色。去掉am-topbar-inverse則顯示灰色-->
        <div class="am-topbar am-topbar-inverse">
            <h1 class="am-topbar-brand">
           		<a href="#">網(wǎng)站Logo</a>
            </h1>
            <div class="am-topbar-right am-fr">
            <!--在導航欄的最右方,定義兩個按鈕,一個是以文字的形式,跳轉(zhuǎn)到其它頁面,一個則是以按鈕形式,觸發(fā)側(cè)邊欄。-->
                <button class="am-topbar-btn am-btn am-btn-sm am-btn-primary" onClick="javascript:window.location.href='#'">其它</button>
                <button class="am-topbar-btn am-btn am-btn-sm am-btn-primary" data-am-offcanvas="{target: '#offcanvasId'}"><span class="am-icon-bars"></span></button>
            </div>
		</div>

然后是側(cè)邊欄的代碼:

因此,整個頁面的代碼如下:

<!--使用HTML5開發(fā)-->
<!doctype html>
<html class="no-js">
<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
        <meta http-equiv="X-UA-Compatible" content="IE=edge">
        <!--自動適應移動屏幕-->
        <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
        <!--優(yōu)先使用webkit內(nèi)核渲染-->
        <meta name="renderer" content="webkit">
        <!--不要被百度轉(zhuǎn)碼-->
        <meta http-equiv="Cache-Control" content="no-siteapp"/>
        <!--以下才是引入amazeui資源-->
        <link rel="stylesheet" href="assets/css/amazeui.min.css">
        <link rel="stylesheet" href="assets/css/app.css">
        <!--引入js的時候要注意,必須先引入jQuery,再引入amazeui,因為這個框架是基于jQuery開發(fā)的-->
        <script src="assets/js/jquery.min.js"></script>
        <script src="assets/js/amazeui.min.js"></script>
        <title>Header</title>
    </head>
 
    <body>
    	<!--這里的頂部導航欄與Bootstrap一種,也只提供深淺兩色。唯一不同的是,Bootstrap是灰黑兩色,AmazeUI則是灰藍兩色。去掉am-topbar-inverse則顯示灰色-->
        <div class="am-topbar am-topbar-inverse">
            <h1 class="am-topbar-brand">
           		<a href="mIndex-index.html">網(wǎng)站Logo</a>
            </h1>
            <div class="am-topbar-right am-fr">
            <!--在導航欄的最右方,定義兩個按鈕,一個是以文字的形式,跳轉(zhuǎn)到其它頁面,一個則是以按鈕形式,觸發(fā)側(cè)邊欄。-->
                <button class="am-topbar-btn am-btn am-btn-sm am-btn-primary" onClick="javascript:window.location.href='#'">其它</button>
                <button class="am-topbar-btn am-btn am-btn-sm am-btn-primary" data-am-offcanvas="{target: '#offcanvasId'}"><span class="am-icon-bars"></span></button>
            </div>
		</div>
        <!-- 側(cè)邊欄內(nèi)容 -->
        <div id="offcanvasId" class="am-offcanvas">
            <div class="am-offcanvas-bar">
                <div class="am-offcanvas-content">
                    <ul class="am-menu-nav am-avg-sm-1">
                        <li class="">側(cè)邊欄菜單</li>
                        <li>----------</li>
                        <li><a href="#">功能1</a></li>
                        <li><a href="#">功能2</a></li>
                        <li><a href="#">功能3</a></li>
                    </ul>
                </div>
            </div>
        </div>
        <!--接下去,你可以自由發(fā)揮了。-->
	</body>
</html> 

值得注意的是,此頂部導航條Header不會出現(xiàn),滾動條怎么滾動,都一直懸停在頭部的情況。相當于一個普通的頁面內(nèi)容而已。

總結(jié)

那么以上就是關于:“html5AmazeUI頂部導航條與側(cè)邊導航欄實現(xiàn)案例分析!”這方面的相關內(nèi)容和代碼,更多和AmazeUI相關的內(nèi)容我們都可以在W3Cschool中進行學習和了解!


0 人點贊