Paul-DS / bootstrap-year-calendar

[DEPRECATED] A fully customizable year calendar widget, for boostrap !
Apache License 2.0
293 stars 243 forks source link

Close the day element when clicking anywhere #236

Open thaqiftaher opened 5 years ago

thaqiftaher commented 5 years ago

Hi,

I have modified the code so that the event info will be shown just after we clicked the specific day. I changed the mouseOnDay to clickDay and set the popover to show. This is the code:

clickDay: function(e) {
            if(e.events.length > 0) {
                var content = '';

                for(var i in e.events) {
                    content += '<div class="event-tooltip-content">'
                                    + '<div class="event-name" style="color:' + e.events[i].color + '; white-space:nowrap;">' + e.events[i].name + '</div>'
                                    + '<div class="event-location">' + e.events[i].location + '</div>'
                                + '</div>';
                }

                $(e.element).popover({ 
                    trigger: 'manual',
                    container: 'body',
                    html:true,
                    content: content,
                    placement: 'auto'
                });

                $(e.element).popover('show');
            }

        }

I would love to close the info when we click anywhere. mouseOutDay is not quite the right fit for this case. Is there anyway to achieve this?