How can I override defaults in jQuery Fullcalendar

戏子无情 提交于 2019-12-29 06:19:10

问题


I use Fullcalendar on my site, but I need all text in different language. There is piece of code in that plugin:

 // function for adding/overriding defaults

 var setDefaults = fc.setDefaults = function(d) {
    $.extend(true, defaults, d);
 };

But I have no ideas how I can use it. Please, I need help.


回答1:


You just override the settings when creating the fullcalendar. Like this:

 var options = {
   theme: true,
   header: {
    left: 'prev,next today',
    center: 'title',
    right: 'month,agendaWeek,agendaDay'
   },
   timeFormat: {
    agenda: 'h(:mm)t{ - h(:mm)t}',
    '': 'h(:mm)t{-h(:mm)t }'
   },
   monthNames: ["Enero","Febrero","Marzo","Abril","Mayo","Junio","Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre" ], 
   monthNamesShort: ['Ene','Feb','Mar','Abr','May','Jun','Jul','Ago','Sep','Oct','Nov','Dic'],
   dayNames: [ 'Domingo', 'Lunes', 'Martes', 'Miércoles', 'Jueves', 'Viernes', 'Sábado'],
   dayNamesShort: ['Dom','Lun','Mar','Mié','Jue','Vie','Sáb'],
   buttonText: {
    today: 'hoy',
    month: 'mes',
    week: 'semana',
    day: 'día'
   }
  };

    $('#calendar').fullCalendar(options);



回答2:


The properties for this kind of thing are documented here:

http://arshaw.com/fullcalendar/docs/text/



来源:https://stackoverflow.com/questions/2996152/how-can-i-override-defaults-in-jquery-fullcalendar

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!