JQuery mobile touch device date selection plug-in Mobiscroll usage example

Source: Internet
Author: User
Tags datetime touch

The input control of the new date type in HTML5 <input type= "Date", but the date selection interface looks different in various browsers.

This describes a date-selection control specifically for mobile devices: Mobiscroll. (You can also use it in a desktop Web project if you want to)

1,mobiscroll Introduction

(1) Mobiscroll is a date and time picker jquery plugin for touch devices (Android phones, IPhone, IPad, Galaxy Tab).
(2) The control time type can be: date, time, or date + time. It is convenient for the user to simply swipe the number to select both dates.
(3) can set the optional time range, the minimum time, the maximum time, the default time and so on.
(4) Users can customize the theme, completely through the CSS file to modify the style.
(5) Perfect use in Ios4,android 2.2, Android 2.3 browser, Safari browser, Firefox, IE9 and other browsers above.

2, the effect chart is as follows:


3, using the sample:

The code is as follows Copy Code

<! DOCTYPE html>
<meta charset= "UTF-8" >
<title>hangge.com</title>
<meta name= "viewport" content= "initial-scale=1.0, maximum-scale=1.0, User-scalable=no"/>
<link rel= "stylesheet" type= "Text/css" href= "/css/mobiscroll.core-2.5.2.css"./>
<link rel= "stylesheet" type= "Text/css" href= "/css/mobiscroll.animation-2.5.2.css"./>
<script type= "Text/javascript" src= "/jquery-1.11.1.min.js" > </script>
<script type= "Text/javascript" src= "/js/mobiscroll.core-2.5.2.js" ></script>
<script type= "Text/javascript" src= "/js/mobiscroll.core-2.5.2-zh.js" ></script>
<script type= "Text/javascript" src= "/js/mobiscroll.datetime-2.5.1.js" ></script>
<script type= "Text/javascript" src= "/js/mobiscroll.datetime-2.5.1-zh.js" ></script>
<script type= "Text/javascript" >
$ (function () {
var curryear = (new Date ()). getFullYear ();
var opt={};
Opt.date = {preset: ' Date ', Mindate:new date ()}; The minimum time is today
Opt.default = {
Theme: ' Android-ics light ',//skin style
Display: ' Modal ',//Show mode
Mode: ' Scroller ',//date selection pattern
Lang: ' En ',
STARTYEAR:CURRYEAR-20,//Start year
Endyear:curryear + 20//End Year
};

Set Date control configuration
$ ("#appDateTime"). Val ('). Scroller (' Destroy ')
. Scroller ($.extend (opt[' Date ', opt[' Default '));

Set initialization time (day)
$ ("#appDateTime"). Scroller (' setdate ', New Date (), true);
});
</script>
<body>
<input id= "Appdatetime" name= "In_date"/>
</body>

This plugin you can download from the release to the Internet, here only to introduce the use of the method does not introduce the download OH.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.