Tooltip for fullcalendar in year view

前端 未结 5 945
一生所求
一生所求 2020-12-08 05:35

I want to add tooltip for the fullcalendar in year view. I tried with the below one but it added tooltip to month view. I tried with google but did not find anything related

5条回答
  •  不知归路
    2020-12-08 06:10

    As fullcalendar has changed the events in the latest version as per the documentation I am changing the jincheng's answer with little more detailed answer

    The popup will look like this

    It doesn't need any js or css plugins

    you can change the event data or payload with one more object for tooltip stuff and use it in your js like

            events: [
            {
                title: 'My Event',
                start: '2019-01-01',
                popup: {
                    title: 'This is the title',
                    descri: 'This is the description',
                }
            }
            // more events here
            ],
            eventMouseEnter: function(info) {
                var tis=info.el;
                var popup=info.event.extendedProps.popup;
                var tooltip = '
    ' + popup.title + '
    ' + popup.descri + '
    '; var $tooltip = $(tooltip).appendTo('body'); // If you want to move the tooltip on mouse movement then you can uncomment it // $(tis).mouseover(function(e) { // $(tis).css('z-index', 10000); // $tooltip.fadeIn('500'); // $tooltip.fadeTo('10', 1.9); // }).mousemove(function(e) { // $tooltip.css('top', e.pageY + 10); // $tooltip.css('left', e.pageX + 20); // }); }, eventMouseLeave: function(info) { console.log('eventMouseLeave'); $(info.el).css('z-index', 8); $('.tooltipevent').remove(); },

    The css for the tooltip to look like the above screenshot

    .tooltipevent{
        width:200px;/*
        height:100px;*/
        background:#ccc;
        position:absolute;
        z-index:10001;
        transform:translate3d(-50%,-100%,0);
        font-size: 0.8rem;
        box-shadow: 1px 1px 3px 0px #888888;
        line-height: 1rem;
    }
    .tooltipevent div{
        padding:10px;
    }
    .tooltipevent div:first-child{
        font-weight:bold;
        color:White;
        background-color:#888888;
        border:solid 1px black;
    }
    .tooltipevent div:last-child{
        background-color:whitesmoke;
        position:relative;
    }
    .tooltipevent div:last-child::after, .tooltipevent div:last-child::before{
        width:0;
        height:0;
        border:solid 5px transparent;/*
        box-shadow: 1px 1px 2px 0px #888888;*/
        border-bottom:0;
        border-top-color:whitesmoke;
        position: absolute;
        display: block;
        content: "";
        bottom:-4px;
        left:50%;
        transform:translateX(-50%);
    }
    .tooltipevent div:last-child::before{
        border-top-color:#888888;
        bottom:-5px;
    }
    

提交回复
热议问题