jquery UI datepicker 弹出位置样式自定义代码样例
来源:互联网 发布:sql loader 704 编辑:程序博客网 时间:2024/06/13 12:27
向老外学习代码研究的真透彻。
quote:
First I think there should be a afterShowing
method in the datepicker object, where you could change the position after jquery has done all its voodoo in the_showDatepicker
method. Additionally, a parameter calledpreferedPosition
would be also desirable, so you could set it and jquery modify it in case the dialog is rendered outside the viewport.
There's a "trick" to do this last thing. If you study the _showDatepicker
method, you will see the use of a private variable$.datepikcer._pos
. That variable will be setup if nobody has set it up before. If you modify that variable before showing the dialog, Jquery will take it and will try to allocate the dialog in that position, and if it renders out of the screen, it will adjust it to make sure it is visible. Sounds good, eh?
Problem is; _pos
is private, but if you don't mind that. You can:
$('input.date').datepicker({ beforeShow: function(input, inst) { $.datepicker._pos = $.datepicker._findPos(input); //this is the default position $.datepicker._pos[0] = whatever; //left $.datepicker._pos[1] = whatever; //top }});
But be careful of Jquery-ui updates, because a change in the internal implementation of the_showDatepicker
might break your code.
mycode:
$('#<%= StartTime.ClientID%>,#<%= EndTime.ClientID%>').datetimepicker({
showSecond: true,timeFormat: 'hh:mm:ss',
stepHour: 1,
stepMinute: 1,
stepSecond: 1,
beforeShow: function (input, inst) {
$.datepicker._pos = $.datepicker._findPos(input); //this is the default position
// $.datepicker._pos[0] = whatever; //left
$.datepicker._pos[1] = 46; //top
inst.dpDiv.css('font-size' ,'30%');
},
beforeShow: function (a, b) {
var cnt = 0; var interval = setInterval(function ()
{
cnt++;
if (b.dpDiv.is(":visible"))
{
var parent = b.input.closest("div"); b.dpDiv.position({ my: "left top", at: "left bottom", of: parent }); clearInterval(interval);
}
else
if (cnt > 50)
{
clearInterval(interval); } }, 10); b.dpDiv.css('font-size','62.5%');
}
- jquery UI datepicker 弹出位置样式自定义代码样例
- 【点滴】-jquery.ui.datepicker指定任意位置显示
- JQuery UI - datepicker
- jquery ui datepicker使用
- Jquery UI datepicker 实用
- jquery ui datepicker详解
- jquery ui datepicker demo
- jquery ui datepicker
- JQuery UI Datepicker
- JQuery UI datepicker 使用方法
- jQuery UI datepicker
- jquery ui datepicker
- jQuery UI插件之datepicker的自定义设置
- jquery弹出层代码,自动判断位置
- 18 UI美化自定义主题样式代码
- jQuery UI Datepicker中文显示
- jQuery UI Datepicker中文显示
- jQuery UI Datepicker中文显示
- 异常值处理的常用方法
- Android widget 用法总结
- 在Activity中判断另一个程序是否存在
- 第二章 快速排序
- 【iOS-iap防护】验证用户付费收据!拒绝iap Cracker!拒绝iap Free!让iphone越狱用户无从下手!【2012年5月2日更新防护iap Free的方法】
- jquery UI datepicker 弹出位置样式自定义代码样例
- 管理处理器的亲和性(affinity)
- php的JSON模块编译错误
- A collection of papers related with topic models[To be added more]
- popupwindow入门详解
- 关于unity3d发布到安卓设备图片丢失的问题
- Java抽象类和接口的区别
- JAVA Date超强工具类,可直接取代util.Date使用
- In-App Purchase iap 内付费 二次验证代码