您需要JavaScript代碼才能使其正常工作。
<body>
<div id="hsectionchangerPage" class="ui-page" data-enable-page-scroll="false">
<div id="pageIndicator" class="ui-page-indicator"></div>
<link rel="stylesheet" href="css/sectionchanger.css">
<div class="ui-content content-padding">
<button type="button" class="ui-more">More Options</button>
</div>
<div id="hsectionchanger" class="ui-content">
<!-- section changer has only one child. -->
<div>
<section style="text-align:center" >
<h3> LEFT2 PAGE </h3>
</section>
<section style="text-align:center">
<h3> LEFT1 PAGE </h3>
</section>
<section class="ui-section-active" style="text-align:center">
<h3> MAIN PAGE </h3>
</section>
<section style="text-align:center">
<h3> RIGHT1 PAGE </h3>
</section>
<section style="text-align:center">
<h3> RIGHT2 PAGE </h3>
</section>
</div>
</div>
<!-- Square Profile -->
<div id="moreoptionsPopup" class="ui-popup" data-transition="slideup">
<div class="ui-popup-header">Options</div>
<div class="ui-popup-content">
<ul class="ui-listview">
<li><a href="#">1</a></li>
<li><a href="#">2</a></li>
<li><a href="#">3</a></li>
</ul>
</div>
</div>
<!-- Circle Profile -->
<div id="moreoptionsPopupCircle" class="ui-popup">
<div id="selector" class="ui-selector">
<div class="ui-item show-icon" data-title="Show"></div>
<div class="ui-item human-icon" data-title="Human"></div>
<div class="ui-item delete-icon" data-title="Delete"></div>
<div class="ui-item show-icon" data-title="Show"></div>
<div class="ui-item human-icon" data-title="Human"></div>
<div class="ui-item delete-icon" data-title="Delete"></div>
<div class="ui-item x-icon" data-title="X Icon"></div>
<div class="ui-item fail-icon" data-title="Fail"></div>
<div class="ui-item show-icon" data-title="Show"></div>
<div class="ui-item human-icon" data-title="Human"></div>
<div class="ui-item delete-icon" data-title="Delete"></div>
<div class="ui-item show-icon" data-title="Show"></div>
<div class="ui-item human-icon" data-title="Human"></div>
<div class="ui-item delete-icon" data-title="Delete"></div>
<div class="ui-item x-icon" data-title="X Icon"></div>
<div class="ui-item fail-icon" data-title="Fail"></div>
<div class="ui-item show-icon" data-title="Show"></div>
<div class="ui-item human-icon" data-title="Human"></div>
<div class="ui-item delete-icon" data-title="Delete"></div>
<div class="ui-item show-icon" data-title="Show"></div>
<div class="ui-item human-icon" data-title="Human"></div>
<div class="ui-item delete-icon" data-title="Delete"></div>
<div class="ui-item x-icon" data-title="X Icon"></div>
<div class="ui-item fail-icon" data-title="Fail"></div>
<div class="ui-item show-icon" data-title="Show"></div>
<div class="ui-item human-icon" data-title="Human"></div>
<div class="ui-item delete-icon" data-title="Delete"></div>
<div class="ui-item show-icon" data-title="Show"></div>
<div class="ui-item human-icon" data-title="Human"></div>
<div class="ui-item delete-icon" data-title="Delete"></div>
<div class="ui-item x-icon" data-title="X Icon"></div>
<div class="ui-item fail-icon" data-title="Fail"></div>
</div>
</div>
<script src="hsection.js"></script>
<script type="text/javascript" src="moreoptions.js"></script>
</div>
<script type="text/javascript" src="../../../lib/tau/wearable/js/tau.min.js"></script>
</body>
hsection.js
(function() {
var page = document.getElementById("hsectionchangerPage"),
changer = document.getElementById("hsectionchanger"),
sectionLength = document.querySelectorAll("section").length,
elPageIndicator = document.getElementById("pageIndicator"),
sectionChanger,
pageIndicator,
pageIndicatorHandler;
/**
* pagebeforeshow event handler
* Do preparatory works and adds event listeners
*/
page.addEventListener("pagebeforeshow", function() {
// make PageIndicator
pageIndicator = tau.widget.PageIndicator(elPageIndicator, { numberOfPages: sectionLength });
pageIndicator.setActive(2);
// make SectionChanger object
sectionChanger = tau.widget.SectionChanger(changer, {
circular: false,
orientation: "horizontal",
useBouncingEffect: true
});
});
/**
* pagehide event handler
* Destroys and removes event listeners
*/
page.addEventListener("pagehide", function() {
// release object
sectionChanger.destroy();
});
/**
* sectionchange event handler
*/
pageIndicatorHandler = function (e) {
pageIndicator.setActive(e.detail.active);
};
changer.addEventListener("sectionchange", pageIndicatorHandler, false);
}());
moreoptions.js
/*global tau */
/*jslint unparam: true */
(function(){
/**
* page - More option page element
* popup - More option popup element for rectangular devices
* handler - Element for opening more option popup
* popupCircle - More option popup element for circular devices
* elSelector - Selector element in the circular popup
* selector - TAU selector instance
*/
var page = document.querySelector("#hsectionchangerPage"),
popup = page.querySelector("#moreoptionsPopup"),
handler = page.querySelector(".ui-more"),
popupCircle = page.querySelector("#moreoptionsPopupCircle"),
elSelector = page.querySelector("#selector"),
selector,
clickHandlerBound;
/**
* Click event handler for opening more option popup
*/
function clickHandler() {
if (tau.support.shape.circle) {
tau.openPopup(popupCircle);
} else {
tau.openPopup(popup);
}
}
/**
* pagebeforeshow event handler
* Do preparatory works and adds event listeners
*/
page.addEventListener("pagebeforeshow", function() {
var radius = window.innerHeight/2 * 0.8;
clickHandlerBound = clickHandler.bind(null);
handler.addEventListener("click", clickHandlerBound);
if (tau.support.shape.circle) {
selector = tau.widget.Selector(elSelector, {itemRadius: radius});
}
});
/**
* pagebeforehide event handler
* Destroys and removes event listeners
*/
page.addEventListener("pagebeforehide", function() {
handler.removeEventListener("click", clickHandlerBound);
if (tau.support.shape.circle) {
selector.destroy();
}
});
/**
* When user click the indicator of Selector, drawer will close.
*/
elSelector.addEventListener("click", function(event) {
var target = event.target;
if (tau.support.shape.circle) {
// 'ui-selector-indicator' is default indicator class name of Selector component
if (target.classList.contains("ui-selector-indicator")) {
tau.closePopup(popupCircle);
}
}
});
}());
也與大家分享您的JS代碼兩個指示燈和Moreoption –