|
这是一个gear S2测试在Tizen SDK 2.3.1的示例代码。
- <div id="main" class="ui-page" data-enable-page-scroll="false" >
- <header class="ui-header">
- <h2 class="ui-title">SectionChanger</h2>
- </header>
- <div id="sectionchanger" class="ui-content">
- <!--Section changer has only one child-->
- <div>
- <section>
- <h3>LEFT1 PAGE</h3>
- </section>
- <section class="section-active">
- <h3>MAIN PAGE</h3>
- </section>
- <section>
- <h3>RIGHT1 PAGE</h3>
- </section>
- </div>
- </div>
- </div>
- var page = document.getElementById("main"),
- element = document.getElementById("sectionchanger"),
- sectionChanger, idx=1;
- page.addEventListener("pageshow", function() {
- /* Create the SectionChanger object */
- sectionChanger = tau.widget.SectionChanger(element, {
- circular: true,
- orientation: "horizontal",
- useBouncingEffect: true
- });
- });
- page.addEventListener("pagehide", function() {
- /* Release the object */
- sectionChanger.destroy();
- });
- document.addEventListener("rotarydetent", function(event){
- if (event.detail.direction === "CW") {
- sectionChanger.setActiveSection(sectionChanger.getActiveSectionIndex() + 1, 100);
- } else {
- sectionChanger.setActiveSection(sectionChanger.getActiveSectionIndex() - 1, 100);
- }
- }, false);
复制代码 |
|