为什么不同时使用fullCalendar和datePicker工作?

时间:2016-05-03 06:36:09

标签: javascript jquery html

目前是日历函数的代码,但datePicker没有 如果我复制/粘贴,以便日期选择器代码第二次运行,但日历不会。 fullcalendar来源http://fullcalendar.io/ datepicker来源https://jqueryui.com/datepicker/#min-max

    <meta charset="utf-8">
    <link rel="stylesheet" href="https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
    <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
    <script src="https://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
    <link rel="stylesheet" href="https:/resources/demos/style.css">
      <script type="text/javascript">
        $(function() {
            $( "#datepicker" ).datepicker({ minDate: +1, maxDate: "+1Y" });
        });
      </script>
    <!--  code above is the code for the datepicker -->


    <!--  code below is the code for the calendar  -->
    <link rel='stylesheet' href='fullcalendar-2.6.1(1)/fullcalendar-2.6.1/fullcalendar.css' />
    <script src='fullcalendar-2.6.1(1)/fullcalendar-2.6.1/lib/jquery.min.js'></script>
    <script src='fullcalendar-2.6.1(1)/fullcalendar-2.6.1/lib/moment.min.js'></script>
    <script src='fullcalendar-2.6.1(1)/fullcalendar-2.6.1/fullcalendar.js'></script>

    <script type="text/javascript">
    $(document).ready(
        function(){
            $('#calendar').fullCalendar({
                weekends:false,
                defaultView:'agendaWeek',
                header: {
                    left:'prev,today,next',
                    center:'title',
                    right:'month,agendaWeek'
                },
            });
        });

1 个答案:

答案 0 :(得分:0)

正如@Guruprasad和我自己所指出的那样,你的文件包含很乱。

看来你是新人,所以这次是正确的做法。 您不需要所有$(func...因为您在调用函数之前使用document.ready事件来触发,这意味着此时jquery可用。

希望它有所帮助!

 <meta charset="utf-8">
    <link rel="stylesheet" href="https://code.jquery.com/ui/1.11.4/themes/smoothness/jquery-ui.css">
     <link rel='stylesheet' href='fullcalendar-2.6.1(1)/fullcalendar-2.6.1/fullcalendar.css' />
    <link rel="stylesheet" href="https:/resources/demos/style.css">


    <script src="https://code.jquery.com/jquery-1.10.2.js"></script>
    <script src="https://code.jquery.com/ui/1.11.4/jquery-ui.js"></script>
    <script src='fullcalendar-2.6.1(1)/fullcalendar-2.6.1/lib/moment.min.js'></script>
    <script src='fullcalendar-2.6.1(1)/fullcalendar-2.6.1/fullcalendar.js'></script>

    <script type="text/javascript">
    $(document).ready(

            $( "#datepicker" ).datepicker({ minDate: +1, maxDate: "+1Y" });


            $('#calendar').fullCalendar({
                weekends:false,
                defaultView:'agendaWeek',
                header: {
                    left:'prev,today,next',
                    center:'title',
                    right:'month,agendaWeek'
                },
            });

     });