3 Star 0 Fork 0

Gitee 极速下载 / pushbuttonjs

加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
此仓库是为了提升国内下载速度的镜像仓库,每日同步一次。 原始仓库: https://github.com/gtdalp/pushbutton
克隆/下载
贡献代码
同步代码
取消
提示: 由于 Git 不支持空文件夾,创建文件夹后会生成空的 .keep 文件
Loading...
README
MIT

pushbutton 移动端弹出列表选择框

移动端从下往上推动画效果端弹出列表选择框,适应所有主流移动端机型,支持Node引入,require引入;

demo地址: https://gtdalp.github.io/widget/pushbutton/demos/pushbutton.html

###npm安装

npm install pushbuttonjs

使用方法如下:

###1、html结构

<section id="pushbutton"></section>

###2、需要引入的js

<script src="../build/pushbutton.min.js"></script>

###3、调用

new Pushbutton('#pushbutton', {
    data: [
        {text:'拍照', cls: 'photo', attr: {'data-key': 'photo'} },
        {text:'录像', attr: [
            {key1: 'video2'},
            {key2: 'video2'}
        ]},
        {text:'语音录入'}
    ],
    // 点击回调 返回true 则不隐藏弹出框
    onClick: function( e ) {
        console.log(e);
        // 返回主要有用数据
        // e.target  当前dom节点
        // e.data  当前点击的data
        // e.index  当前点击的选择是第几个
        return true;
    },
    // maxHeight: 100,  // 默认显示的高度
    isShow: true   // 默认是否显示
});
var dom = document.getElementById("pushbuttonClick");
var refresh = document.getElementById("refresh");

dom.onclick = function () {
    pub.show();
}
refresh.onclick = function () {
    pub.refresh({
        data: [{text: '1321321321'}]
    });
}

效果图 demo1.png

###4、API

####4.1 options.data 数据

options.data = [
    {text:'拍照', cls: 'photo', attr: {'data-key': 'photo'} },
    {text:'录像', attr: [
        {key1: 'video2'},
        {key2: 'video2'}
    ]},
    {text:'语音录入'}
]

####4.2 options.onClick 点击回调 返回true 则不隐藏弹出框

options.onClick = function( e ) {
    console.log(e);
    // 返回主要有用数据
    // e.target  当前dom节点
    // e.data  当前点击的data
    // e.index  当前点击的选择是第几个
    return true;
}

####4.3 maxHeight 默认显示的高度

options.maxHeight = 100  // 默认显示的高度

####4.4 isShow 默认是否显示

options.isShow = false   // 默认是否显示  默认不显示

####4.5 show 显示

Pushbutton.show()   // 显示

####4.6 hide 隐藏

Pushbutton.hide()   // 隐藏

####4.7 refresh 刷新

Pushbutton.refresh({
    .. // options 可以传options
})   // 刷新
MIT License Copyright (c) 2016 hapjs Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

简介

暂无描述 展开 收起
JavaScript 等 3 种语言
MIT
取消

发行版

暂无发行版

贡献者

全部

近期动态

加载更多
不能加载更多了
1
https://gitee.com/mirrors/pushbuttonjs.git
git@gitee.com:mirrors/pushbuttonjs.git
mirrors
pushbuttonjs
pushbuttonjs
master

搜索帮助