我如何覆盖jQuery Fullcalendar中的默认值 [英] How can I override defaults in jQuery Fullcalendar
本文介绍了我如何覆盖jQuery Fullcalendar中的默认值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在我的网站上使用 Fullcalendar ,但我需要使用不同语言的所有文本。这个插件中有一段代码:
//添加/覆盖默认值的函数
var setDefaults = fc.setDefaults = function(d){
$ .extend(true,defaults,d);
};
但我不知道如何使用它。请帮助我。
解决方案创建fullcalendar时,您只需重写设置即可。像这样:
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:{
今天:'hoy',
月:'mes',
星期:'semana',
日:'día'
}
};
$('#calendar')。fullCalendar(options);
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.
解决方案
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);
这篇关于我如何覆盖jQuery Fullcalendar中的默认值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文