Mobile-side Region selection control Mobile-select-area
As a result of the previous [JS Open source Component Development]JS mobile phone linkage Select Region imitation iOS open source git is very popular, so I have some optimizations, including the optional range is bigger, add the default empty header address function, but also add more API parameters, first we first look at this.
Its GitHub address please click on the Https://github.com/tianxiangbing/mobile-select-area
Click here for demo demo http://www.lovewebgames.com/jsmodule/mobile-select-area.html
This is still quoted dialog this plugin, but deleted the Zeptojs, instead of jquery, because Zepto still have some animation calculation has problems, of course, can also be compatible with ZEPTOJS, as you like it, but to remove the tap event, instead of the Click event, You can choose to load Fastclick this plugin to speed up clicks.
Okay, let's introduce the API.
Default0||1
0 is NULL, true when the first item is selected by default, and the default 1
Trigger
The DOM element that triggers the pop-up window, which can be input or other
Value
Initial value,
Levelint
Number of levels, default is level 3
Separator,
ID value delimiter
EventName:tap|click
Trigger event name, default click, can use tap event with Zeptojs
Data
当data为json对象时可以直接解析,此时直接接收数组当data为string发送ajax请求后返回json,格式如下:
{ "Data": [{ "ID":1, "name":"Zhejiang province", " Child": [{ "ID":"1", "name":"Hangzhou City", " Child": [{ "ID":1, "name":"Bingjiang District" }] }] }, { "ID":2, "name":"Jiangsu Province", " Child": [{ "ID":"1", "name":"Nanjing", " Child": [{ "ID":1, "name":"Liberated areas" }] }] }, { "ID":3, "name":"Hubei Province" }]}Callback:function (Scroller,text,value)
The first one is the container, the second is the text value after the selection, and the third parameter is the ID after the selection. And this points to the current object. The selected callback defaults to the value of the padding trigger, and the value of the hidden that is immediately following the assignment, separated by commas, separated by spaces
With this plugin, we can also breed another component by modifying the data source, which is the date selection component, such as:
JS component-The address of the mobile-phone Select date is: http://www.lovewebgames.com/jsmodule/mobile-select-date.html
GitHub Source address is: https://github.com/tianxiangbing/mobile-select-date
Thanks for watching!
JS Component Development-Mobile-side region selection control Mobile-select-area