Drupal Calendar View 的显示设置画面无法打开
🏷️ Drupal
装了 Calendar 模块之后创建了日历的 View. 发现 View 的显示设置画面无法打开.
Console 里提示:
.live() is not a function
之前换主题主要 jQuery1.9 以上的版本,所以装了 jQuery Update 模块,把 jQuery 的版本升到了 1.10,导致了该问题.
把 calendar\js\calendar_colorpicker.js 的内容修改为如下内容,就可以代开显示设置画面了.
php
/**
* Implementation of hook_elements.
*
* Much of the colorpicker code was adapted from the Colorpicker module.
* That module has no stable release yet nor any D6 branch.
*/
/*
* Bind the colorpicker event to the form element
*/
(function ($) {
Drupal.behaviors.field_example_colorpicker = {
attach: function(context) {
// $(".edit-calendar-colorpicker").live("focus", function(event) {
$("body").on("focus", ".edit-calendar-colorpicker", function(event) {
var edit_field = this;
var picker = $(this).closest('div').parent().find(".calendar-colorpicker");
// Hide all color pickers except this one.
$(".calendar-colorpicker").hide();
$(picker).show();
$.farbtastic(picker, function(color) {
edit_field.value = color;
}).setColor(edit_field.value);
});
}
}
})(jQuery);