效果图

html代码,需要引入jquery,layui,fullCalendar

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>fullCalendar</title> <link rel="stylesheet" href="fullcalendar-3.9.0/fullcalendar.print.css" media='print' />
<link rel="stylesheet" href="fullcalendar-3.9.0/fullcalendar.css" /> <!--<script src="https://cdn.bootcss.com/jquery/3.3.1/jquery.min.js"></script>-->
<!--<script src="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.6.1/fullcalendar.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.6.1/fullcalendar.min.css"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.6.1/fullcalendar.print.css"></script>-->
<style> body {
margin: 40px 10px;
padding: 0;
font-family: "Lucida Grande",Helvetica,Arial,Verdana,sans-serif;
font-size: 14px;
} #calendar {
max-width: 900px;
margin: 0 auto;
} </style>
<script src="layui/layui.all.js"></script>
<link rel="stylesheet" href="layui/css/layui.css">
</head>
<body>
<button class="layui-btn" onclick="render()">btn</button>
<button class="layui-btn" onclick="destory()">destory</button>
<div id='calendar'></div>
</body> <script src="fullcalendar-3.9.0/lib/jquery.min.js"></script>
<script src="fullcalendar-3.9.0/lib/moment.min.js"></script>
<script src="fullcalendar-3.9.0/lib/jquery-ui.min.js"></script>
<script src="fullcalendar-3.9.0/fullcalendar.js"></script>
<script> $(document).ready(function() { $('#calendar').fullCalendar({
customButtons: {
myCustomButton: {
text: '自定义按钮',
click: function() {
alert('点击了自定义按钮!');
}
}
},
//头工具栏,三个位置,左中右,https://www.helloweba.net/javascript/447.html#fc-header 有固定参数。
header: {
left: 'prev,next today myCustomButton',
center: 'title',
right: 'month,agendaWeek,agendaDay'
},
defaultDate: '2018-11', //默认时间,
defaultView:'month', //默认视图
editable: true,//可以被编辑
weekNumbers:true,//显示周数
selectable: true,//是否允许用户单击或者拖拽日历中的天和时间隙。默认false。
firstDay: 1,//设置每周第一天,数字int型,默认0(周日)
timezone: 'local',//时区
timeFormat: 'HH:mm:ss',//时间格式
eventLimit: true, // allow "more" link when too many events
loading: function( isLoading, view ){
//暂时这里没有看到效果
console.log("loading回调",view)
},
events: [ //日历显示的事件,数组形式显示的
{
title: 'All Day Event',
start: '2018-11-01',
color:'red'//不同事件不同颜色
},
{
title: 'Long Event',
start: '2018-11-07',
end: '2018-11-10',
colorl:'blue'
},
{
id: 999,
title: 'Repeating Event',
start: '2018-11-09T16:00:00',
color:'#30ff18'
},
{
id: 999,
title: 'Repeating Event',
start: '2018-11-16T16:00:00'
},
{
title: 'Conference',
start: '2018-11-11',
end: '2018-11-13'
},
{
title: 'Meeting',
start: '2018-11-12T10:30:00',
end: '2018-11-12T12:30:00'
},
{
title: 'Lunch',
start: '2018-11-12T12:00:00'
},
{
title: 'Meeting',
start: '2018-11-12T14:30:00'
},
{
title: 'Happy Hour',
start: '2018-11-12T17:30:00'
},
{
title: 'Dinner',
start: '2018-11-12T20:00:00'
},
{
title: 'Birthday Party',
start: '2018-11-13T07:00:00'
},
{
title: 'Click for Google',
url: 'http://google.com/',
start: '2018-11-28'
}
],
eventMouseover: function( event, jsEvent, view ) { //鼠标划过的事件
layer.tips(event.title, this);
},
eventMouseout:function( event, jsEvent, view ) { //鼠标离开的事件
var index = layer.tips();
layer.close(index);
},
selectAllow : function(clickInfo) {//禁止点击的控制,是否允许点击false不让点击, 将用户选择限制到某些时间窗口。仅当selectable选项是激活状态时可用。值为事件id或对象。
var start = clickInfo.start.unix();//获取点击的开始时间
console.log("点击是否允点击");
//如果大于当前时间就让点击,否则就不让点击,提示
if(clickInfo.start >= new Date()){
return true;
}
//不让点击了 提示
layer.msg("选择时间小于当前时间,不可以点击过去的时间");
return false;
},
select:function(start, end, jsEvent) { //点击日历上的某个时间触发的函数
//layer.msg("点击时间控件" + JSON.stringify(jsEvent));
/*
执行顺序,先执行selectAllow:判断是否可以点击
然后执行select:点击了时间空间出发的事件,这两个控件其实感觉在上边的那个里边写逻辑就可以
如果可以执行的事件,就在上边那个里边直接写,不可以执行的,就直接提示反馈fase,这样就不可以点击了。
*/
layer.msg("点击时间控件");
},
eventClick: function(eventObj) {//点击日期控件上显示的事件触发的事件
layer.msg("我点击的是:11" + eventObj.title );
console.log("我点击的是",eventObj)
},
}); }); /**
* 重新渲染事件到日程控件上
* https://www.helloweba.net/javascript/454.html#fc-EventSourceObject
*/
function render(){
var json = '{"state":"ok","msg":"操作成功!","calendar":[{"id":1121,"title":"3344- 辅导辅导13 [ 津津]","start":"2018-11-22 15:30:00","remarks":"课程:3344- 辅导辅导13<br>校区:中心校区<br>教室:花样教室<br>教师:米桂<br>时间:15:30:00-16:00:00<br>课时:1<br>上课学员姓名:津津","end":"2018-11-22 16:00:00"}]}';
var s = $.parseJSON( json );
$('#calendar').fullCalendar('renderEvents', s.calendar, true);//批量渲染事件到日程控件上
} /**
* 移除日程插件上的事件
*/
function destory(){
$("#calendar").fullCalendar('removeEvents');
}
</script>
</html>

fullCalendar插件基本使用的更多相关文章

  1. ASP.NET MVC5+EF6+EasyUI 后台管理系统(86)-日程管理-fullcalendar插件用法

    前言 本文分享fullcalendar用法,最后面提供代码下载 说到日程管理,基于JQuery的插件FullCalendar当之无愧,完整的API稳定和调用方式,非常易于扩展!可以用于系统的个人历程管 ...

  2. fullcalendar插件日程管理

    日程管理-fullcalendar插件用法   前言 本文分享fullcalendar用法,最后面提供代码下载 说到日程管理,基于JQuery的插件FullCalendar当之无愧,完整的API稳定和 ...

  3. FullCalendar插件的基本使用

    我的另一博客地址:https://segmentfault.com/u/lyrfighting/articles 前段时间,一直在开发考勤系统,当时为满足设计的需求,选了好几个插件,最后决定采用Ful ...

  4. js jquery 实现 排班,轮班,日历,日程。使用fullcalendar 插件

    如果想用fullcalendar实现排班功能,或者日历.日程功能.那么只需要简单的几步: 这里先挂官网链接: fullcalendar fullcalendar官网下载链接 一.下载及简单配置 1.这 ...

  5. Easyui+MVC+FullCalendar插件实现日程记录功能

    好久好久好久,,,没有写博客了,,久到账号都忘记了....分享一个干货.... 废话少说,先看看效果图. 要实现这样一个功能,先创建一个用于存储日程的记录表(不要问我为什么都是大写,因为初版在orac ...

  6. 日历插件FullCalendar应用:(二)数据增删改

    接上一篇 日历插件FullCalendar应用:(一)数据展现. 这一篇主要讲使用fullcalendar插件如何做数据的增删改,用到了art.dialog web对话框组件,上一篇用到的webFor ...

  7. FullCalendar应用——整合农历节气和节日

    FullCalendar用来做日程管理功能非常强大,但是唯一不足的地方是没有将中国农历历法加进去,今天我将结合实例和大家分享如何将中国农历中的节气和节日整合到FullCalendar中,从而增强其实用 ...

  8. FullCalendar Timeline View 使用

    FullCalendar  Timeline View(v4) The Scheduler add-on provides a new view called “timeline view” with ...

  9. Jquery 记一次使用fullcalendar的使用记录

    最近接了一个需求,把excel做的表格开发到系统里,本来想直接做成表格的形式,后来考虑到数据库中的表结构不好设计,最后决定做成日历的形式: 先上成品图 需要引用的js,fullcalendar官网可以 ...

随机推荐

  1. 使用MagicAJax的AjaxPanel时有时会弹出"Using the AjaxCallHelper write methods outside of an AjaxCall is not allowed."

    ------解决方案--------------------------------------------------------1.看下你的输出是不是包含在<ajax:AjaxPanel I ...

  2. leetcode44

    public boolean isMatch(String text, String pattern) { // 多一维的空间,因为求 dp[len - 1][j] 的时候需要知道 dp[len][j ...

  3. selenium初次接触-1

    10月30日 web自动化测试的两种方式:模拟整个http客户端(压力测试,取代浏览器和人,直接和服务端进行交互),模拟用户操作(功能测试,取代人) selenium是自动化浏览器的工具包,可以用于各 ...

  4. Spring boot 启动配置原理

    配置在META-INF/spring.factories 有几个主要的类 ApplicationContextInitializer    创建SpringAplication SpringAppli ...

  5. Centos6与Centos7防火墙设置与端口开放的方法

    Centos升级到7之后,内置的防火墙已经从iptables变成了firewalld.所以,端口的开启还是要从两种情况来说明的,即iptables和firewalld.更多关于CentOs防火墙的最新 ...

  6. alias 设置别名

    我们在使用Linux中使用较长的命令而且要经常要使用时,总是会使用别名,这里就简单的介绍一下别名alias 指令:alias设置指令的别名 语法:#  alias name='command line ...

  7. js删除dom节点时候索引出错问题

    我们知道删除一个dom节点的时候索引就会发生了改变,甚至是错误,就算jq的ecah也无能为力,所以我们只能自己写个功能了 直接上代码把,不多说 <!DOCTYPE html> <ht ...

  8. 跨域(四)——document.domain

    浏览器有一个合法的性质:一个页面可以设置document.domain为当前子域或比当前子域更高级的域.一般顶级就到了根域,如果设置为其他域,浏览器就会报权限错误. 利用这个性质,我们可以通过设置do ...

  9. MIME sniffing攻击

    基于IE的MIME sniffing功能的跨站点脚本攻击 IE有一个特性,那就是在将一个文件展示给用户之前会首先检查文件的类型,这乍看起来并没什么问题,但实际上这是相当危险的,因为这会允许IE执行图片 ...

  10. .net上的 jpa

    还没试过,有空试试: NPersistence ORSQL