小编给大家分享一下jquery.mobile如何实现手机滚动,相信大部分人都还不怎么了解,因此分享这篇文章给大家参考一下,希望大家阅读完这篇文章后大有收获,下面让我们一起去了解一下吧!
<!-- <!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="viewport"
content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no">
<link rel="stylesheet"
href="../../../ui/jquery.mobile-1.4.5/jquery.mobile-1.4.5.css">
<script src="../../../ui/jquery.mobile-1.4.5/js/jquery.js"></script>
<script src="../../../ui/jquery.mobile-1.4.5/jquery.mobile-1.4.5.min.js"></script>
</head>
<body> -->
<div data-role="page" id="mytabs"
>
<script type="text/javascript">
if (!$.mobile.data) {
$.mobile.data = {};
}
if (!$.mobile.data.tabNames) {
$.mobile.data.tabNames = [ '健康体检', '美容抗衰', '口腔健康', '功能医学', '康复疗养' ];
$.mobile.data.clickTab = function(tab) {
var index = $(tab).attr('data-tab-index');
$('#mytabs .fragments').hide();
$('#fragment-' + index).show();
}
$.mobile.data.moveToPrevTab = function() {
var $Navbar = $('#mytabs-navbar');
var index = parseInt($Navbar.attr('data-tab-index'));
if (index > 0) {
$Navbar.find('a').each(
function(i, e) {
var no = index - 1 + i;
$(e).text($.mobile.data.tabNames[no]).attr(
'data-tab-index', no);
}).filter('.ui-btn-active').click();
$Navbar.attr('data-tab-index', --index);
if (index == 0) {
$('#mytabs-prev').css('color', '#ccc');
} else {
$('#mytabs-next').css('color', '#000');
}
}
};
$.mobile.data.moveToNextTab = function() {
var $Navbar = $('#mytabs-navbar');
var index = parseInt($Navbar.attr('data-tab-index'));
if (index < 2) {
$Navbar.find('a').each(
function(i, e) {
var no = index + 1 + i;
$(e).text($.mobile.data.tabNames[no]).attr(
'data-tab-index', no);
}).filter('.ui-btn-active').click();
$Navbar.attr('data-tab-index', ++index);
if (index == 2) {
$('#mytabs-next').css('color', '#ccc');
} else {
$('#mytabs-prev').css('color', '#000');
}
}
};
}
</script>
<div data-role="header" data-position="fixed" data-theme="b"
>
<h2>健康中心</h2>
<a href="../../app/main.html" data-icon="back" data-iconpos="notext">Back</a>
<a href="#opt-panel" data-icon="gear" data-iconpos="notext"
>Options</a>
</div>
<div class="ui-content" role="main">
<div
>
<div
>
<a id="mytabs-prev" href="#" class="ui-btn ui-mini"
onclick="$.mobile.data.moveToPrevTab();"><</a>
</div>
<div id="mytabs-navbar" data-role="navbar" data-tab-index="0">
<ul>
<li><a href="#" data-tab-index="0" class="ui-btn-active"
onclick="$.mobile.data.clickTab(this);">健康体检</a></li>
<li><a href="#" data-tab-index="1"
onclick="$.mobile.data.clickTab(this);">美容抗衰</a></li>
<li><a href="#" data-tab-index="2"
onclick="$.mobile.data.clickTab(this);">口腔健康</a></li>
</ul>
</div>
<div
>
<a id="mytabs-next" href="#" class="ui-btn ui-mini"
onclick="$.mobile.data.moveToNextTab();">></a>
</div>
</div>
<div id="fragment-0" class="fragments">
<div >
<ul data-role="listview" class="ul">
<li class="li"><a
href="../health/detail.html"><div
>
<img src="../../../Image/App/hb_20.jpg"
>
</div> 体检套餐</a></li>
<li class="li"><a
href="#"><div
>
<img src="../../../Image/App/hb_20.jpg"
>
</div>健康之旅</a></li>
<li class="li"><a
href="#"><div
>
<img src="../../../Image/App/hb_20.jpg"
>
</div>健康管理计划</a></li>
<li class="li"><a
href="#"><div
>
<img src="../../../Image/App/hb_20.jpg"
>
</div>基因检测</a></li>
<li class="li"><a
href="#"><div
>
<img src="../../../Image/App/hb_20.jpg"
>
</div>中医检测</a></li>
<li class="li"><a
href="#"><div
>
<img src="../../../Image/App/hb_20.jpg"
>
</div>体能检测</a></li>
<li class="li"><a
href="#"><div
>
<img src="../../../Image/App/hb_20.jpg"
>
</div>心里检测</a></li>
<li class="li"><a
href="#"><div
>
<img src="../../../Image/App/hb_20.jpg"
>
</div>营养评估</a></li>
</ul>
</div>
</div>
<div id="fragment-1" class="fragments" >
<div >
<ul data-role="listview" class="ul">
<li class="li"><a
href="#"><div
>
<img src="../../../Image/App/hb_20.jpg"
>
</div>光子嫩肤</a></li>
<li class="li"><a
href="#"><div
>
<img src="../../../Image/App/hb_20.jpg"
>
</div>冰点脱毛</a></li>
<li class="li"><a
href="#"><div
>
<img src="../../../Image/App/hb_20.jpg"
>
</div>果酸换肤</a></li>
<li class="li"><a
href="#"><div
>
<img src="../../../Image/App/hb_20.jpg"
>
</div>玻糖酸</a></li>
<li class="li"><a
href="#"><div
>
<img src="../../../Image/App/hb_20.jpg"
>
</div>保妥适</a></li>
</ul>
</div>
</div>
<div id="fragment-2" class="fragments" >
<div >
<ul data-role="listview" class="ul">
<li class="li"><a
href="#"><div
>
<img src="../../../Image/App/hb_20.jpg"
>
</div>口腔种植</a></li>
<li class="li"><a
href="#"><div
>
<img src="../../../Image/App/hb_20.jpg"
>
</div>超薄贴面</a></li>
<li class="li"><a
href="#"><div
>
<img src="../../../Image/App/hb_20.jpg"
>
</div>无痛洁牙</a></li>
<li class="li"><a
href="#"><div
>
<img src="../../../Image/App/hb_20.jpg"
>
</div>牙齿矫正</a></li>
</ul>
</div>
</div>
<div id="fragment-3" class="fragments" >
<div >
<ul data-role="listview" class="ul">
<li class="li"><a
href="#"><div
>
<img src="../../../Image/App/hb_20.jpg"
>
</div>功能医学</a></li>
<li class="li"><a
href="#"><div
>
<img src="../../../Image/App/hb_20.jpg"
>
</div>荷尔蒙疗法</a>
</ul>
</div>
</div>
<div id="fragment-4" class="fragments" >
<div >
<ul data-role="listview" class="ul">
<li class="li"><a
href="#"><div
>
<img src="../../../Image/App/hb_20.jpg"
>
</div>运动康复</a></li>
<li class="li"><a
href="#"><div
>
<img src="../../../Image/App/hb_20.jpg"
>
</div>度假疗养</a>
<li class="li"><a
href="#"><div
>
<img src="../../../Image/App/hb_20.jpg"
>
</div>康复套餐</a>
</ul>
</div>
</div>
</div>
</div>
<!-- </body></html> -->
以上是“jquery.mobile如何实现手机滚动”这篇文章的所有内容,感谢各位的阅读!相信大家都有了一定的了解,希望分享的内容对大家有所帮助,如果还想学习更多知识,欢迎关注编程网行业资讯频道!