www.91084.com

GVKun编程网logo

jquery-ui – Jquery Datepicker Days

37

此处将为大家介绍关于jquery-ui–JqueryDatepickerDays的详细内容,此外,我们还将为您介绍关于jqueryjQueryUIDatepicker时间插件设置、jQuerylive

此处将为大家介绍关于jquery-ui – Jquery Datepicker Days的详细内容,此外,我们还将为您介绍关于jquery jQueryUIDatepicker时间插件设置、jQuery live()与jQuery UI datepicker失败、jquery UI 1.72 之datepicker_jquery、jQuery UI Datepicker与jQuery tipsy的有用信息。

本文目录一览:

jquery-ui – Jquery Datepicker Days

jquery-ui – Jquery Datepicker Days

我已经包含了一个 jqueryUI Datepicker,我需要将2个字母的日期改为1个字母,例如.而不是周日的“苏”,它将成为周日和其他的“S”….
我该怎么改呢???

解决方法

我只是想知道同样的事情.查看api后我发现你可以将一个选项传递给datepicker以更改日期名称.这是api部分:
http://api.jqueryui.com/datepicker/#option-dayNamesMin

这是一个例子:

$("#datepicker").datepicker({
    dayNamesMin: ['S','M','T','W','F','S']
});

jquery jQueryUIDatepicker时间插件设置

jquery jQueryUIDatepicker时间插件设置

在做项目的时候用到了时间插件,在这里分享一下。以后自己在用的时候不用瞎找 使用方法下载地址: http://pan.baidu.com/s/1hqxjcUS
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">   
<html lang="en" xmlns="http://www.w3.org/1999/xhtml">  
<head> 
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> 
<title>XXXXX</title> 
<link rel="stylesheet" media="all" type="text/css" href="css/jquery-ui.css"/> 
<link rel="stylesheet" media="all" type="text/css" href="css/jquery-ui-timepicker-addon.css"/> 
<script type="text/javascript" src="js/jquery-1.7.2.js"></script> 
<script type="text/javascript" src="js/jquery-ui.min.js"></script> 
<script type="text/javascript" src="js/jquery-ui-timepicker-addon.js"></script> 
<script type="text/javascript" src="js/jquery-ui-sliderAccess.js"></script> 
<script type="text/javascript" src="js/jquery-ui-timepicker-zh-CN.js"></script> 
<script type="text/javascript"> 

    $(function(){

        //只显示时间分\钟

        //$(''#example'').timepicker({});

        //年月日时间都有
        $("#example").datetimepicker({showMonthAfterYear:!0,minDate:0,dateFormat:"yy-mm-dd"});
    }); 
</script> 
<style type="text/css">  
        #ui-datepicker-div, .ui-datepicker{ font-size: 80%; }            
</style> 
</head> 
    <body>  
            <input type="text" name="example" id="example" value="" /> 
    </body>  
</html>
 

jQuery live()与jQuery UI datepicker失败

jQuery live()与jQuery UI datepicker失败

好的,我试图将jQuery的FaceBox()插件和jQuery UI datepicker()一起使用.

我已经把它绑定到灯箱的第一次出现的灯箱的输入,但它后来没有工作.

我正在做以下事情:

$(function() { 
    $('.jQueryCalendar').live('click',function () {
            $(this).datepicker({showOn: 'both'}).focus();
    });
});

当灯箱关闭时,我将其内容重新附加到页面(为了不丢失内容div),这似乎是杀死了live()调用. [注意,原始内容销毁后再次追加]

编辑

好的,live()事件被触发(感谢Nick Craver为此),但是datepicker不再显示.有谁有一个想法为什么?

编辑#2

好的,使用.html()来重新附加会导致事件需要重新绑定,但是绑定的元素仍然具有hasDatepicker类,它与datepicker()初始化混淆.

要修复,只需用户

$(this).removeClass('hasDatepicker') .datepicker({showOn: 'both'}).focus();

解决方法

尝试一下,看看会发生什么:
$(function() { 
    $('.jQueryCalendar').live('click',function () {
            $(this).datepicker('destroy').datepicker({showOn: 'both'}).focus();
    });
});

如果您在jQuery 1.4中使用jQuery UI 1.7.2,某些效果会破坏小部件,它会褪色等可能会导致datepicker问题. jQuery UI 1.8修复了这个,现在在RC3状态.

jquery UI 1.72 之datepicker_jquery

jquery UI 1.72 之datepicker_jquery

复制代码 代码如下:


jQuery UI Datepicker与jQuery tipsy

jQuery UI Datepicker与jQuery tipsy

有关如何在jQuery的UI Datepicker上实现 tipsy工具提示的任何想法?基本上我想在用户在Datepicker中的特定日期移动时获得工具提示. Datepicker将以内联方式显示并始终可见.

谢谢!

解决方法

听起来很酷,

这是我的解决方案.阅读评论.

(function($){


/** 
 * Returns a dictionary,where the keys are the day of the month,* and the value is the text.
 * @param year - The year of the events.
 * @param month - The month of the events.
 * @param calendarID - Events for a specific calendar.
 */
function getMonthEvents(year,month,calendarId){
  return {11: "My birthday.",23: "My anniversary" };
}

// Receives January->1
function addTipsys(year,calendarId){
   var theEvents = getMonthEvents(year,calendarId);
   var theDateLinks = $('#' + calendarId + ' .ui-datepicker-calendar a');
   for(eventDay in theEvents){
      // Minus one,because the date in the tipies are regular dates (1-31)
      // and the links are 0-based.
      theDateLinks.eq(eventDay-1)  // select the right link
         .attr('original-title',theEvents[eventDay])  // set the text
         .tipsy();   // init the tipsy,set your properties.
   }
}

// Because the the event `onChangeMonthYear` get's called before updating 
// the items,we'll add our code after the elements get rebuilt. We will hook 
// to the `_updateDatepicker` method in the `Datepicker`.
// Saves the original function.
var _updateDatepicker_o = $.datepicker._updateDatepicker;
// Replaces the function.
$.datepicker._updateDatepicker = function(inst){ 
   // First we call the original function from the appropiate context.
   _updateDatepicker_o.apply(this,[inst]); 
   // No we can update the Tipsys.
   addTipsys(inst.drawYear,inst.drawMonth+1,inst.id);
};

// Finally the calendar initializer.
$(function(){
   // Creates the date picker,with your options.
   $("#datepicker").datepicker();
   // Gets the date and initializes the first round of tipsies.
   var currentDate = $('#datepicker').datepicker('getDate');
   // month+1 because the event considers January->1
   // Last element is null,because,it doesn't actualy get used in the hanlder.
   addTipsys(currentDate.getYear(),currentDate.getMonth()+1,'datepicker');
});

})(jQuery);

不便之处:

>当用户从可见月份中选择一天,或者通过datepicker(‘setDate’,theDate)设置日期时,也会调用_updateDatepicker方法,这可能效率不高.
>它依赖于Datepicker的私有函数,如果在将来的版本中他们决定更改它的功能,或者更改名称,则此代码将中断.虽然由于功能的性质,我不认为很快就会发生这种情况.

注意:
我的第一种方法是挂钩ui.datepicker的onChangeMonthYear事件,但由于事件被触发,在替换日历中的日期之前,addTipsys方法会将tipsy添加到即将获得的日历日期清除.因此需要在元素刷新后调用addTipsys事件.

很容易:将方法挂钩到日历的onChangeMonthYear事件,然后执行setTimeout来调用tipsy.需要进行一些验证.

我们今天的关于jquery-ui – Jquery Datepicker Days的分享已经告一段落,感谢您的关注,如果您想了解更多关于jquery jQueryUIDatepicker时间插件设置、jQuery live()与jQuery UI datepicker失败、jquery UI 1.72 之datepicker_jquery、jQuery UI Datepicker与jQuery tipsy的相关信息,请在本站查询。

本文标签:

上一篇jQuery计算窗口yScroll位置(jquery获取窗口宽度)

下一篇jQuery Bootstrap:“TypeError:’undefined’不是一个函数(评估’jQuery(‘#myModal’).modal(‘hide’)’)