After Init

Issue #13 resolved
Former user created an issue

Callback for after the calendar is rendered. On Init, renders before days are loaded.

Comments (3)

  1. Lukasz Kokoszkiewicz repo owner

    Hi, can You describe the situation You are facing in more detail?

    I will consider adding another callback anyway, but it would be helpful if you could describe me how it will help you?

  2. Mohammad Walid

    It's very useful to add after initialize callback use case:

    $('.responsive-calendar').responsiveCalendar({
            onDayClick: dayClick,
            afterInit: function(){
                setClicked(getUrlParameter('date'));
            },
            allRows: false
        });
    function setClicked(date){
        parts = date.split('-');
    
        $element = $('a[data-year="'+parts[0]+'"][data-month="'+(parts[1]-1)+'"][data-day="'+parts[2]+'"]');
        if($element.parent().is('.not-current')){
            return;         
        }
    
        if($element.parent('div.day.future, div.day.today').length > 0){
            $('div.clicked').removeClass('clicked');
            $element.parent().addClass('clicked');
        }
    }
    
  3. Log in to comment