App下載

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

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

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

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

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


 

首先是頂部導(dǎo)航欄的代碼:

<!--這里的頂部導(dǎo)航欄與Bootstrap一種,也只提供深淺兩色。唯一不同的是,Bootstrap是灰黑兩色,AmazeUI則是灰藍(lán)兩色。去掉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">
            <!--在導(dǎo)航欄的最右方,定義兩個(gè)按鈕,一個(gè)是以文字的形式,跳轉(zhuǎn)到其它頁面,一個(gè)則是以按鈕形式,觸發(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è)邊欄的代碼:

因此,整個(gè)頁面的代碼如下:

<!--使用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">
        <!--自動(dòng)適應(yīng)移動(dòng)屏幕-->
        <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的時(shí)候要注意,必須先引入jQuery,再引入amazeui,因?yàn)檫@個(gè)框架是基于jQuery開發(fā)的-->
        <script src="assets/js/jquery.min.js"></script>
        <script src="assets/js/amazeui.min.js"></script>
        <title>Header</title>
    </head>
 
    <body>
    	<!--這里的頂部導(dǎo)航欄與Bootstrap一種,也只提供深淺兩色。唯一不同的是,Bootstrap是灰黑兩色,AmazeUI則是灰藍(lán)兩色。去掉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">
            <!--在導(dǎo)航欄的最右方,定義兩個(gè)按鈕,一個(gè)是以文字的形式,跳轉(zhuǎn)到其它頁面,一個(gè)則是以按鈕形式,觸發(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> 

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

總結(jié)

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


0 人點(diǎn)贊