This time I will share jQuery Plugin and tutorial about Mobile-friendly Anything Picker Plugin For jQuery – AnyPicker, hope it will help you in programming stack.
AnyPicker is a jQuery plugin for building a generic picker where the users are able to select anything (dates, times, fonts, icons, etc) from a themeable, mobile-friendly picker view.
Key features:
- 4 built-in themes: Default, iOS, Android and Mobile Phone.
- 4 layouts: popup, relative, fixed and inline.
- Responsive and cross-platform.
- CSS3 powered animations.
- i18n/RTL/LTR support.
- Tons of configuration options and callbacks.
- Custom templates.
Install it via package managers:
2 |
$ npm install anypicker |
5 |
$ bower install anypicker |
Basic usage:
1. Load the jQuery AnyPicker plugin’s main style sheet and a theme CSS of your choice in the document.
2 |
< link rel = "stylesheet" href = "anypicker-font.css" > |
4 |
< link rel = "stylesheet" href = "anypicker.css" > |
6 |
< link rel = "stylesheet" href = "anypicker-ios.css" > |
7 |
< link rel = "stylesheet" href = "anypicker-android.css" > |
8 |
< link rel = "stylesheet" href = "anypicker-windows.css" > |
2. Create a normal input field the picker should be appended to.
1 |
< input type = "text" id = "demo" readonly> |
3. Load jQuery library and the jQuery AnyPicker’s JavaScript file at the end of the document.
1 |
< script src = "jquery.min.js" ></ script > |
2 |
< script src = "anypicker.js" ></ script > |
4. Call the plugin to create a datetime picker for the input field.
5. Config the picker with the following options.
01 |
$( "#demo" ).AnyPicker({ |
19 |
inputChangeEvent: "onSet" , |
26 |
animationDuration: 500, |
32 |
markup: "<a id='ap-button-set' class='ap-button'>Set</a>" , |
33 |
markupContentWindows: "<span class='ap-button-icon ap-icon-set'></span><span class='ap-button-text'>set</span>" , |
40 |
markup: "<a id='ap-button-clear' class='ap-button'>Clear</a>" , |
41 |
markupContentWindows: "<span class='ap-button-icon ap-icon-clear'></span><span class='ap-button-text'>clear</span>" , |
48 |
markup: "<a id='ap-button-now' class='ap-button'>Now</a>" , |
49 |
markupContentWindows: "<span class='ap-button-icon ap-icon-now'></span><span class='ap-button-text'>now</span>" , |
56 |
markup: "<a id='ap-button-cancel' class='ap-button'>Cancel</a>" , |
57 |
markupContentWindows: "<span class='ap-button-icon ap-icon-cancel'></span><span class='ap-button-text'>cancel</span>" , |
64 |
markup: "<span class='ap-header__title'>Select</span>" , |
66 |
contentBehaviour: "Static" , |
74 |
header: [ "headerTitle" ], |
77 |
footer: [ "cancelButton" , "setButton" ] |
82 |
headerTitle: "Select" , |
86 |
cancelButton: "Cancel" , |
87 |
dateSwitch: "
source : jqueryscript.net
|