Events calendar with clickable days using jQuery i

2020-07-09 06:40发布

I'm about to create a solution that will list events that will occur in specific days, and was looking for a Calendar control that I can deal with to make only the days with events clickable, and of course receive this click event and handle the rest myself in my Controller. (something like the old asp:Calendar server-side control in Webforms).

is there any that match this scenario?

Update: What I'm exactly looking for is a Mini Calendar, not a full Calendar like the one in Outlook.

this is what I'm exactly looking for:

enter image description here

9条回答
祖国的老花朵
2楼-- · 2020-07-09 06:45

If you can still use Javascript in your code, take this control and customize its UI. It has source code available for your own customization requirements.

http://www.javascriptkit.com/script/script2/eventscalendar.shtml#

enter image description here

查看更多
倾城 Initia
3楼-- · 2020-07-09 06:45

I realise this is beyond late as an answer, but your question is quite high up in Google results, so hopefully it will help other people. I wrote an article on this very topic here: Datepicker based MVC3 Events Calendar

查看更多
beautiful°
4楼-- · 2020-07-09 06:47

You can use jquery UI datepicker along with the beforeShowDay event to customize which days are selectable and which days are not. Here is the minimal code which disables selecting the date 5 and you can extend the logic.

$(function() {
    $( "#datepicker" ).datepicker({
       beforeShowDay: function(date) {
           if(date.getDate() == 5){
                return[false, ''];           
           }
           else{
               return[true, ''];
           }
       }
    });
});

Here's a quick demo

查看更多
再贱就再见
5楼-- · 2020-07-09 06:50

I made something like this a couple of years ago by heavily modifying a javascript calendar called MooTools Event Calendar

There are several other javascript calendars that look pretty good as well. These 2 use JQuery:

查看更多
趁早两清
6楼-- · 2020-07-09 06:51

jQuery UI can do the exact styling you want.. (and functionality)

You will need to download the jQuery UI script and the Smoothness theme (visit http://jqueryui.com/download/ and select core and datepicker from the radio buttons, and smoothness from the drop-down to the right)

html

<div id="datepicker"></div>

javascript

var activeDays=[1,4,10,21,22,23,27,28,30];

$('#datepicker').datepicker(
    {
        beforeShowDay: function(date) {
            var hilight = [false,''];

            if ( activeDays.indexOf( date.getDate() ) > -1)
            {
                hilight = [true,'isActive'];
            }

            return hilight;
        }
    }
);

The activeDays variable could hold dates directly (instead of just the day number) and you would need to alter the conditional inside the function to check for a match.

The isActive is a class used to control the styling of the active dates..

.isActive a.ui-state-default{
    background:none;
    background-color:pink;
}

Live example at http://jsfiddle.net/gaby/C95nx/2/

the above code and example renders as

enter image description here

查看更多
Rolldiameter
7楼-- · 2020-07-09 06:51

Many people use the jQuery UI datepicker. I'm not sure of a built in asp.net mvc control for the calendar.

查看更多
登录 后发表回答