Javascript jQuery - 移动日期选择器控件
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/5549729/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
jQuery - Mobile date picker control
提问by Satch3000
Is there a Date Picker control that I could use on jQuery Mobile?
是否有我可以在 jQuery Mobile 上使用的日期选择器控件?
It needs to be able to save dates locally, etc.
它需要能够在本地保存日期等。
回答by Donovan Woodside
回答by Tim
There is an experimental calendar. I used it successfully.
有一个实验日历。我成功地使用了它。
Take a look here: http://jquerymobile.com/test/experiments/ui-datepicker/
看看这里:http: //jquerymobile.com/test/experiments/ui-datepicker/
回答by tosha Shah
I am developing a PhoneGapapplication and where I need datepicker/calender capabilities:
我正在开发一个PhoneGap应用程序,我需要日期选择器/日历功能:
Basically on your page you add algon with CSS and JavaScript code for jQuery Mobile:
基本上在您的页面上,您为jQuery Mobile添加带有 CSS 和 JavaScript 代码的 algon :
<script type="text/javascript" src="http://dev.jtsage.com/cdn/datebox/latest/jquery.mobile.datebox.min.js"></script>
<link rel="stylesheet" type="text/css" href="http://dev.jtsage.com/cdn/datebox/latest/jquery.mobile.datebox.min.css" />
<div data-role="content">
<input name="myminutesdate" id="myminutesdate" type="date" data-role="datebox"
data-options='{"mode": "calbox","dateFormat":"%m/%d/%Y","calUsePickers": true, "calNoHeader": true,"highDates": ["2012-12-07" , "2012-07-12"] }' ></input>
Most importantly:
最重要的是:
$("#minutesPage").live('pageshow',function(event) {
var today = new Date();
var date = today.getDate();
var month = (today.getMonth()+1);
var year = today.getFullYear();
var todayStr = month+"/"+date+"/"+year;
$('#myminutesdate').trigger('datebox', {'method':'set', 'value':todayStr});
});
Also, if you don't want a popup, you can make it static.
此外,如果您不想要弹出窗口,您可以将其设为静态。
回答by Levi Kovacs
For a calendar view take a look at the Calendar Control
对于日历视图,请查看日历控件
It works with or without date and time spinners (calendar only is possible). It also integrates with jQuery Mobile Themes, if you're looking for that.
它可以使用或不使用日期和时间微调器(仅日历是可能的)。如果您正在寻找它,它还可以与 jQuery Mobile 主题集成。
回答by amurrell
While I was searching for a date picker to use on a mobile devices, I found one (via stackoverflow: https://stackoverflow.com/a/3023446/2100636) that works with jQuery and ui theming. I am adding this one as an answer because it may be good to consider because it's rooted in the idea of functionality. It has options I didn't see with other pickers, and I think I can incorporate it into a responsive/mobile design pretty well. I'll update with my progress if I end up using it.
当我在寻找可在移动设备上使用的日期选择器时,我发现了一个(通过 stackoverflow:https: //stackoverflow.com/a/3023446/2100636)适用于 jQuery 和 ui 主题。我添加这个作为答案是因为考虑它可能很好,因为它植根于功能的想法。它有我在其他选择器中没有看到的选项,我认为我可以很好地将它整合到响应式/移动设计中。如果我最终使用它,我会更新我的进度。
From their website, http://www.ama3.com/anytime/, the description below sums it up better than I can. It's also licensed under Creative Commons.
从他们的网站http://www.ama3.com/anytime/,下面的描述比我能更好地总结它。它也获得了知识共享许可。
For starters, take a look at these DATE/TIME ALTERNATIVES:
首先,看看这些日期/时间替代方案:
12-hour or 24-hour clock
custom date/time format (countless possibilities, including JSON and XML)
date-only, time-only, or specific fields!
date/time range limits
era-selection (BCE/CE, BC/AD, etc.)
start week on any day (Sunday, Monday, etc.)
custom base for 2-digit years (1900, 2000, etc.)
UTC offsets and time zones
Then peep these STYLING CHOICES:
然后看看这些造型选择:
custom labels/languages
custom CSS styles
jQuery UI Theming
jQuery UI Theme Switcher
jQuery ThemeRoller
pop-up or always-present picker
visible or hidden field
It's also PROGRAMMER-FRIENDLY:
这也是程序员友好的:
easy to implement
easy AJAX validation
easy Date/String conversion, including JSON and XML
create multiple pickers at once
easy removal
easy to extend
And let's not forget those USABILITY FEATURES:
让我们不要忘记这些可用性功能:
single-click value selection
double-click select-and-dismiss
WAI-ARIA 1.0 keyboard accessibility
em-based relative-size
回答by tomasantonj
http://dev.jtsage.com/jQM-DateBox/
http://dev.jtsage.com/jQM-DateBox/
The DateBox is very neat and works well for those still looking.
DateBox 非常整洁,对于那些仍在寻找的人来说效果很好。