display the entire calendar for the chosen month

I am currently using Foundation Datepicker and Full Calendar. My requirement is as follows:

1) When I select a date in the calendar,

For example, let's say it's July 2016. If I choose a date in November or any other month in the Foundation Datepicker, the Full Calendar should automatically switch to that selected month. You can take a look at the fiddle provided below where there is one Datepicker and one Full Calendar.

Here is the link to the fiddle for reference:

jsfiddle

The default setting for the Full Calendar is in July month. Initially, there is one more Datepicker available. If I change the date on that Datepicker, the Full Calendar should open on the selected month right away.

var nowTemp = new Date();
      var now = 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>

Answer №1

Take a look at the updated code snippet below:

http://jsfiddle.net/v98sb2a0/12/

If you want FullCalendar to automatically switch to a different month when a date is selected in the datepicker control, you can utilize the gotoDate method of FullCalendar:

Here's an example showcasing how you can integrate Foundation's datepicker with FullCalendar and use its changeDate event handler to update the calendar view:

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 the date of full calendar

    }).data('datepicker');

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

invoking a jquery method through the onClick event handler

How can I make use of jQuery to perform different actions based on which checkbox is clicked? I am encountering an issue where the onClick event is not triggered for any of the checkboxes below. <HTML> <HEAD> <script type="text/javascr ...

Does the media query max-width refer to the size of the viewport or the size of the window?

Can someone clarify whether the max-width in a media query is based on the viewport size or window size? For instance, consider this media query: @media screen and (max-width: 360px){} Would this media query be activated when the viewport reaches 360px ...

Creating UL tabs using just HTML and CSSHere's a step-by-step guide

Looking for help to accomplish this task. I already have the styling, but I want something to happen when I click on the tabs. Specifically, I want the div with the tab class names to show and hide upon clicking the tabs. Currently, nothing happens when I ...

The ajax success() function is failing to function properly when attempting to make a call

The button's onClick() event is not navigating anywhere. There seems to be an issue with the success() function of the ajax call. Unfortunately, I am new to this and unable to pinpoint the problem. var currentAuthor=""; var currentQuote=""; $(documen ...

Tips for executing jsfiddle code within Joomla 3.2

I'm having trouble executing this code on my Joomla website. I have Joomla 3.2 installed with the JCK Editor, but the HTML tags are not functioning correctly. Can someone please assist me in running the following code: $("#text10").keyup(functio ...

Struggling to modify CSS properties for :before and :after pseudo-elements?

My current styling looks like this: section.tipos .content > div:before { background: none repeat scroll 0 0 #DDDDDD; content: " "; height: 10px; left: 32%; position: absolute; top: -10px; width: 10px; } It's working p ...

Managing broken images within an internet browser

Is there a way to hide the broken image icon, similar to what's shown at '', when no image is displayed? I've set up a comment section using PHP and CSS that allows users to leave comments and upload photos. However, if a user decides t ...

What method can be employed to eliminate choice selection lacking any value?

Currently, I am encountering difficulties in my attempt to remove or hide the first option value from a ransack code. Would you be able to assist me in addressing this concern? Here is the HTML CODE that I am working with: <select id="q_c_0_a_0_name" ...

Using CSS to rearrange the order of specific div elements with the nth-child() selector when targeting different

I am attempting to design a centered navbar for a webpage. The navbar consists of 5 divs and my goal is to have the third div become the first one when the screen size goes below 600px. Here is the HTML code: <div class="mainmenu"> < ...

The document.getElementsByClassName method in JavaScript is returning an Array with a length property value of 0

My HTML contains a list of li elements with one class. I am attempting to collect them all and place them in an array to determine how many have been gathered. However, when I attempt to display the number using the .length property of the array returned b ...

What methods can I use to make sure the right side of my React form is properly aligned for a polished appearance?

Trying to create a React component with multiple input field tables, the challenge is aligning the right side of the table correctly. The issue lies in inconsistent alignment of content within the cells leading to disruption in overall layout. Experimente ...

Activate and deactivate button

I've tried multiple examples on this site for enabling and disabling a button using javascript with jquery, but none of them seem to work for me. Here is my current dilemma: <asp:TextBox ID="mytext" runat="server" onkeyup="enableButton(this, 3)"/ ...

Avoid modifying the HTML DOM structure after utilizing the JQuery Load() method

Within an HTML Page, the Ajax Load() function is utilized to load additional HTML files into the current HTML document by targeting a specific element. When clicking on Links, the other HTML pages load correctly. However, despite the code being loaded usin ...

Adding a new row within a table using jQuery at the center position

I am trying to add a new row at the beginning of a table right after the header row. The prepend() method is not working as expected because it inserts the new row before the header. Additionally, the after and before methods are also not giving me the des ...

Assistance needed in creating a MVC3 and Razor 2-level horizontal navigation menu

I am attempting to create a 2-level horizontal menu, similar to the one featured on the following site: TV.Com Despite searching on google, I am struggling to put it all together. Below is the sample code I am working with: <div id="divNav"> <u ...

I am in search of a container that has full height, along with unique footer and content characteristics

I have set up a jsfiddle to demonstrate the scenario I am facing: There is a basic header, content, footer layout. Within the content-container is a messenger that should expand to a maximum of 100% height. Beyond 100% height, it should become scrollable. ...

Mastering the Art of jQuery and Line Breaks

I've been working on a project where I am struggling to figure out how to proceed. The issue is with a textarea element where the user should input text, and that input should be displayed directly in a span. Currently, when the user presses enter, th ...

Using the following-sibling selector in Java, you can easily click on all <li> elements within a <ul> tag

I am trying to navigate through the list of li elements starting from the "Mentorship" tag link <ul _ngcontent-cwp-c18="" class="navigation clearfix"> <li _ngcontent-cwp-c18="" routerlinkactive="current" ...

Create dynamic animations for HTML lists with seamless transitions

I am looking to create a smooth animation effect for an HTML list that moves from left to right and vice versa with a fixed length. The issue I am encountering is that when I click on the right button, it is replacing the list elements instead of animating ...

CSS Text ellipsis displays only the beginning of each paragraph

I want to add ellipsis to a text, but it keeps including the first line of all paragraphs. What I actually need is for only the first line of the content to have the ellipsis applied. Here is an example of the content: When using websocket to send message ...