Which day

Issue #46 resolved
montero lalas created an issue

Is there a function which allows you to recognize a certain day? For example, someone clicks on 12-11-2015 How to recognize that the day was chosen? I would like to assign to this event specific actions in php

And

      $(document).ready(function () {
        $(".responsive-calendar").responsiveCalendar({
          time: '2013-05',
          events: {
            "2013-04-30": {"number": 5, "url": "http://w3widgets.com/responsive-slider"},
            "2013-04-26": {"number": 1, "url": "http://w3widgets.com"}, 
            "2013-05-03":{"number": 1}, 
            "2013-06-12": {}
          },
          onActiveDayClick: function(events) {
              alert('Active click');
          },
          onDayClick: function(events) {
              alert('Day click');
          }
        });
      });

How to assign onActiveDayClick to a specific date?

other for onActiveDayClick to:              "2013-04-30": {"number" 5, "url": "http://w3widgets.com/responsive-slider"}

another for onActiveDayClick to "2013-04-26": {"number": 1, "url": "http://w3widgets.com"}

p.s. how to set up the data since in no way are displayed?

    "name": "ACOUSTIC HITS 90er meets BACKSTREET NOISE"
    "hour": "20:00"

in the calendar to show only the number of events

Comments (7)

  1. Lukasz Kokoszkiewicz repo owner

    You have an answer in the documentation. Each day have a data interface with year, month and day specified. I suggest to use the onDayClick event and check if the right day was clicked. Below you have an example on how to access the days data interface, copy pasted from the website:

    $( document ).ready( function() {
      function addLeadingZero(num) {
        if (num < 10) {
          return "0" + num;
        } else {
          return "" + num;
        }
      }
    
      $('.responsive-calendar').responsiveCalendar({
        onActiveDayClick: function(events) {
          var thisDayEvent, key;
    
          key = $(this).data('year')+'-'+addLeadingZero( $(this).data('month') )+'-'+addLeadingZero( $(this).data('day') );
          thisDayEvent = events[key];
          alert(thisDayEvent.number);
        }
      });
    });
    
  2. montero lalas reporter

    ok, we have something like this:

          $(document).ready(function () {
    
      function addLeadingZero(num) {
        if (num < 10) {
          return "0" + num;
        } else {
          return "" + num;
        }
      }
    
            $(".responsive-calendar").responsiveCalendar({
        onActiveDayClick: function(events) {
          var thisDayEvent, key;
    
          key = $(this).data('year')+'-'+addLeadingZero( $(this).data('month') )+'-'+addLeadingZero( $(this).data('day') );
          thisDayEvent = events[key];
          alert(thisDayEvent.number);
        },
    
              time: '2015-11',
              events: {
                "2015-11-30": {"number": 5, "url": "http://w3widgets.com/responsive-slider"},
                "2015-11-26": {"number": 1, "url": "http://w3widgets.com"}, 
                "2015-12-03":{"number": 1}, 
                "2015-12-12": {}
              },
            });
          });
    

    Now I would like to assign

    alert('Active click 1');
    

    to date: 2015-11-30 And assign

    alert('Active click 2');
    

    to date: 2015-11-26

    how to do it?

  3. Lukasz Kokoszkiewicz repo owner

    Sorry man, but I can't teach a programming here. You have an answer above on how to extract day date from on/Active/DayClick event. All that need to be done is check each time if the day with the right date was clicked.

  4. Log in to comment