首頁 > web前端 > H5教程 > 主體

小強的HTML5行動開發之路(40)-jqMobi中實踐header定義的幾種方式

黄舟
發布: 2017-02-15 13:08:53
原創
1802 人瀏覽過

一、定義全域的header

這個header是所有panel預設的header,需要在

內部,也就是和

同一等級的位置加上一個header 標籤,且id必須是header

例如:


<!DOCTYPE html> 
<html>
<head>
<meta charset="utf-8">
<title>jqMobi</title>

<link href="css/af.ui.css" rel="stylesheet" type="text/css"/>
<link href="css/icons.css" rel="stylesheet" type="text/css"/>
<script src="appframework.js" type="text/javascript"></script>
<script src="ui/appframework.ui.js" type="text/javascript"></script>
</head> 
<body> 
	<p id="afui">
    	<header id="header">
                <a id="backButton" href="javascript:;" class="button" >Back</a>
                <h1>Single Page App</h1>
        </header>
        <p id="content">
            <p id="home">
                <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
                    Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
                    Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
                    Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
                </p>
            </p>
            <p id="sketch">
                <p>sketch</p>
            </p>
        </p>
        <p id="navbar">
                <a href="#home" id=&#39;navbar_home&#39; class=&#39;icon home&#39;>home</a>
                <a href="#sketch" id=&#39;navbar_pencil&#39; class=&#39;icon pencil&#39;>Sketch</a>
                <a href="#picture" id=&#39;navbar_picture&#39; class=&#39;icon picture&#39;>Picture</a>
        </p>
    </p>
</body>
</html>
登入後複製



二、panel引入標籤在內部。和

同一等級的位置頂一個header 標籤,並且命名id。 然後再需要這個header的pane添加一個屬性data-header="custom_header"


<!DOCTYPE html> 
<html>
<head>
<meta charset="utf-8">
<title>jqMobi</title>
<link href="css/af.ui.css" rel="stylesheet" type="text/css"/>
<link href="css/icons.css" rel="stylesheet" type="text/css"/>
<script src="appframework.js" type="text/javascript"></script>
<script src="ui/appframework.ui.js" type="text/javascript"></script>
</head> 
<body> 
	<p id="afui">
		
        <p id="content">
            <p id="home" data-header="custom_header">
                <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
                    Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
                    Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
                    Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
                </p>
            </p>
            <p id="sketch">
                <p>sketch</p>
            </p>
        </p>
        <header id="custom_header">
            <a id="backButton" href="javascript:;" class="button" >Back</a>
            <h1>Single Page App</h1>
        </header>
        <p id="navbar">
                <a href="#home" id=&#39;navbar_home&#39; class=&#39;icon home&#39;>home</a>
                <a href="#sketch" id=&#39;navbar_pencil&#39; class=&#39;icon pencil&#39;>Sketch</a>
                <a href="#picture" id=&#39;navbar_picture&#39; class=&#39;icon picture&#39;>Picture</a>
        </p>
    </p>
</body>
</html>
登入後複製


三、給每個panel自定義header

在需要自定義的panel的內部定義一個header,這個header此時只屬於該panel

<!DOCTYPE html> 
<html>
<head>
<meta charset="utf-8">
<title>jqMobi</title>
<link href="css/af.ui.css" rel="stylesheet" type="text/css"/>
<link href="css/icons.css" rel="stylesheet" type="text/css"/>
<script src="appframework.js" type="text/javascript"></script>
<script src="ui/appframework.ui.js" type="text/javascript"></script>
</head> 
<body> 
	<p id="afui">
        <p id="content">
            <p id="home" class="panel">
                <header>
                    <a id="backButton" href="javascript:;" class="button" >Back</a>
                    <h1>Single Page App</h1>
                </header>
                <p>Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
                    Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.
                    Duis aute irure dolor in reprehenderit in voluptate velit esse cillum dolore eu fugiat nulla pariatur.
                    Excepteur sint occaecat cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum.
                </p>
            </p>
            <p id="sketch">
                <p>sketch</p>
            </p>
        </p>
       
        <p id="navbar">
                <a href="#home" id=&#39;navbar_home&#39; class=&#39;icon home&#39;>home</a>
                <a href="#sketch" id=&#39;navbar_pencil&#39; class=&#39;icon pencil&#39;>Sketch</a>
                <a href="#picture" id=&#39;navbar_picture&#39; class=&#39;icon picture&#39;>Picture</a>
        </p>
    </p>
</body>
</html>
登入後複製

四、給對應的標籤定義title屬性,系統也會自動產生header


路(40)-jqMobi中實踐header定義的幾種方式 的內容,更多相關內容請關注PHP中文網(www.php.cn)!








來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板