jquery - open full calendar based on selected month -
i using foundation datepicker , full calendar. requiement is,
1) if select date in calendar,
for example, current month july 2016. if select date in november or other month in foundation datepicker, full calendar should start selected month. please @ fiddle.one datepicker , 1 full calendar there.
please @ following fiddle.
defaultly full calendar in july month. @ starting 1 mor datepicker there. if change date on datepicker, @ time fullcalendar should opn on selected month.
var nowtemp = new date(); var = new date(nowtemp.getfullyear(), nowtemp.getmonth(), nowtemp.getdate(), 0, 0, 0, 0); var checkin = jquery('#startdate').fdatepicker({ format: "dd.mm.yyyy", }).data('datepicker'); var checkout = jquery('#enddate').fdatepicker({ format: "dd.mm.yyyy", }).on('changedate', function (ev) { }).data('datepicker'); $(document).ready(function() { var date = new date(); var d = date.getdate(); var m = date.getmonth(); var y = date.getfullyear(); var events_array = [ { title: 'test1', start: new date(2012, 8, 20), tip: 'personal tip 1'}, { title: 'test2', start: new date(2012, 8, 21), tip: 'personal tip 2'} ]; $('#calendar').fullcalendar({ header: { left: 'prev,next today', center: 'title', right: 'month,agendaweek,agendaday' }, selectable: true, events: events_array, eventrender: function(event, element) { element.attr('title', event.tip); } }); }); $(".fc-header-left").hide(); $(".fc-header-right").hide(); $(window).scroll(function() { if ($(this).scrolltop() > 1){ $('.fc-border-separate thead').addclass("sticky"); } else{ $('.fc-border-separate thead').removeclass("sticky"); } });
.tag{ background-color:#000; color:#fff; padding:3px; max-height:60px; overflow: visible; position: fixed; z-index:999; } .tag:after { content: ""; border-top: 16px solid red; border-left: 8px solid transparent; border-right: 8px solid transparent; position: absolute; bottom: -16px; left: calc(50% - 8px); } .fc-border-separate thead.sticky{ width: 100%; position: fixed; top:0px; left:0px; display:table; background: #fff; }
</br> datepicker :<input type="text" id="enddate" name="end_datum" class="input_text" value=""></br></br></br></br> <div style="border:solid 2px red;"> <div id='calendar'></div> </div> <div class="tag hide" id="cal-info"> </div>
please have @ updated fiddle code:
http://jsfiddle.net/v98sb2a0/12/
we can use gotodate
method of full calendar force full calendar switch different month select date in datepicker control:
following code foundation datepicker
, changedate
event handler changes month of full calendar:
var checkin = jquery('#startdate').fdatepicker({ format: "dd.mm.yyyy", }).data('datepicker'); var checkout = jquery('#enddate').fdatepicker({ format: "dd.mm.yyyy", }).on('changedate', function(ev) { var startdate = new date(ev.date); $('#calendar').fullcalendar('gotodate', startdate);//modify date of full calendar }).data('datepicker');
Comments
Post a Comment