帖子
帖子
用户
博客
课程
显示全部楼层
216
帖子
5
勋章
5893
Y币

sliderButton模块demo示例

[复制链接]
发表于 2018-11-20 22:22:34
sliderButton模块实现了向右滑动按钮效果。(备注:模块使用时尽量不要让页面上下滑动,否则进度条会卡住。)


点击进入模块详情


  1. <!DOCTYPE html>
  2. <html>
  3.         <head>
  4.                 <title>Module Develop</title>
  5.                 <meta charset="utf-8">
  6.                 <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
  7.                 <style type="text/css">
  8.                         html, body {
  9.                                 height: 100%
  10.                         }
  11.                         body {
  12.                                 background-color: #fff;
  13.                                 margin: 0;
  14.                         }
  15.                         #wrap {
  16.                                 height: 100%;
  17.                                 position: relative;
  18.                         }
  19.                         #header {
  20.                                 padding-top: 20px;
  21.                                 background-color: #5082c2;
  22.                                 height: 44px;
  23.                                 position: relative;
  24.                         }
  25.                         #header h1 {
  26.                                 font-size: 20px;
  27.                                 height: 44px;
  28.                                 line-height: 44px;
  29.                                 margin: 0em;
  30.                                 color: #fff;
  31.                                 margin-left: 100px;
  32.                                 margin-right: 100px;
  33.                                 text-align: center;
  34.                         }
  35.                         #main {
  36.                                 display: -webkit-box;
  37.                                 -webkit-box-orient: vertical;
  38.                                 -webkit-box-pack: center;
  39.                         }
  40.                         a.button {
  41.                                 display: -webkit-box;
  42.                                 -webkit-box-orient: vertical;
  43.                                 -webkit-box-pack: center;
  44.                                 -webkit-box-align: center;
  45.                                 height: 32px;
  46.                                 margin: 8px;
  47.                                 background-color: rgba(240,240,240,1.0);
  48.                                 border-color: rgba(220,220,220,1.0);
  49.                                 border-width: 2px;
  50.                                 border-style: solid;
  51.                         }
  52.                         a.active {
  53.                                 background-color: rgba(240,240,240,0.7);
  54.                         }
  55.                 </style>
  56.         </head>
  57.         <body>
  58.                 <div id="wrap">
  59.                         <div id="main">
  60.                                 <a class="button" tapmode="active" onclick="addEventListener1()">滑块进度监听</a>
  61.                                 <a class="button" tapmode="active" onclick="openSlideBtn()">打开滑块按钮</a>
  62.                                 <a class="button" tapmode="active" onclick="hideSlideBtn()">隐藏滑块按钮</a>
  63.                                 <a class="button" tapmode="active" onclick="showSlideBtn()">显示滑块按钮</a>
  64.                                 <a class="button" tapmode="active" onclick="closeSlideBtn()">关闭滑块按钮</a>
  65.                         </div>
  66.                 </div>
  67.         </body>
  68.         <script type="text/javascript">
  69.                 var demo = null;
  70.                 apiready = function() {
  71.                         demo = api.require('sliderButton');
  72.                         if (!demo) {
  73.                                 alert("请添加模块后编译");
  74.                                 return;
  75.                         }
  76.                 }
  77.                 function addEventListener1() {
  78.                         demo.addEventListener(function(ret, err) {
  79.                                 api.toast({
  80.                                         msg : JSON.stringify(ret)
  81.                                 });
  82.                         });
  83.                 }

  84.                 function openSlideBtn() {
  85.                         demo.openSlideBtn({
  86.                                 rect : {
  87.                                         x : 20,
  88.                                         y : 400,
  89.                                         w : api.frameWidth - 40,
  90.                                         h : 50
  91.                                 },
  92.                                 fixedOn : api.frameName,
  93.                                 fixed : true,
  94. //                                labelText : '我是滑块文字',
  95. //                                labelFontSize : 18.0,
  96. //                                labelTextColor : '#8a4d4d',
  97. //                                borderColor : '#ea1919',
  98. //                                dotColor : '#137548',
  99. //                                skateColor : '#a6ad2f',
  100.                         }, function(ret, err) {
  101.                                 alert(JSON.stringify(ret));
  102.                         });
  103.                 }

  104.                 function hideSlideBtn() {
  105.                         demo.hideSlideBtn(function(ret, err) {
  106.                                 alert(JSON.stringify(ret));
  107.                         });
  108.                 }

  109.                 function showSlideBtn() {
  110.                         demo.showSlideBtn(function(ret, err) {
  111.                                 alert(JSON.stringify(ret));
  112.                         });
  113.                 }

  114.                 function closeSlideBtn() {
  115.                         demo.closeSlideBtn(function(ret, err) {
  116.                                 alert(JSON.stringify(ret));
  117.                         });
  118.                 }
  119.         </script>
  120. </html>
复制代码


12
帖子
0
勋章
2149
Y币
可以定制一下这个模块吗,qq :47627284
216
帖子
5
勋章
5893
Y币
收到。
19
帖子
0
勋章
139
Y币
你好,这个模块可以改样式吗?
216
帖子
5
勋章
5893
Y币
暂不支持修改,,,需要的话可以线下定制修改。。
216
帖子
5
勋章
5893
Y币
qq: 176142998
6
帖子
0
勋章
1506
Y币
为什么背景颜色修改无效
216
帖子
5
勋章
5893
Y币
杨婷青 发表于 2021-10-12 17:11
为什么背景颜色修改无效

安卓?iOS?代码怎么写的?发来我测试看看
您需要登录后才可以回帖 登录

本版积分规则