Jua*_*les 4 javascript jquery fullcalendar
我已经考虑了几天,并检查了 SO 和 API 文档,但我无法找到一种方法来在FullCalendar API中的“select”属性上使用 HTML 弹出框而不是当前提示添加事件。有没有一种简单的方法可以“不”使用另一个插件来做到这一点。并不是说我反对使用插件,这似乎是一件很简单的事情,但出于某种原因,我无法理解它。
编辑
我想做什么...
感谢帮助,谢谢!
好的,所以我能够做到。从正文部分的表单开始...
<div class="popup"><h3>Add an Event</h3>
<form><div>Title: </div><input class="title" type="text" /><br /><br />
<a href="#" class="submitForm">submit</a></form></div>
Run Code Online (Sandbox Code Playgroud)
添加一些样式...
.popup {
background-color:ivory; border:1px solid gray;
position:fixed; top:25%; left:25%; display:none; padding: 0px 20px 10px 10px; z-index:100;
}
.popup form div{float:left; width:80px; text-align:left;}
.popup form input{float:left; text-align:left;}
Run Code Online (Sandbox Code Playgroud)
并像这样提交表单......
select: function(start, end, allDay){
$(".popup").show(); // show's pop up
$(".title").focus(); // auto focus on the field
var start = Date.parse(start) / 1000; // parse the start time to retain value
var end = Date.parse(end) / 1000; // same but with end
$(".submitForm").click(function(){ // on submission
var title = $(".title").val(); // gets title value
if(title != ""){ // if the title exists run script
$.post("insertscript.php", {title: title, start:start, end: end, allDay: allDay}, // be sure to filter data
function(){
$(".title").val(""); // clear title field
start = ""; // clear start time
end = ""; // clear end time
calendar.fullCalendar('unselect');
calendar.fullCalendar('refetchEvents');
});
}
$(".popup").hide(); // hide pop up box
});
},
Run Code Online (Sandbox Code Playgroud)
现在我知道这可能不是最好的方法,但它有效,因为我环顾了三天多才找到答案,而且似乎没有其他人拥有它或至少想要分享它,我终于屈服了我的安全带,然后自己上车了。我希望它可以帮助某人:)
| 归档时间: |
|
| 查看次数: |
3993 次 |
| 最近记录: |