fullcalendar with clickable popup on hover

后端 未结 8 2263
名媛妹妹
名媛妹妹 2020-12-13 11:12

I need a pop up on hover full calendar like this one.

Have tried full calendar with qtip but could not get clickable popup its disappers when mouse is out from the s

相关标签:
8条回答
  • 2020-12-13 11:15
        $(document).ready(function() {
        // Setup FullCalendar
    // Setup FullCalendar
    (function() {
        var date = new Date();
        var d = date.getDate();
        var m = date.getMonth();
        var y = date.getFullYear();
    
        var tooltip = $('<div/>').qtip({
            id: 'fullcalendar',
            prerender: true,
            content: {
                text: ' ',
                title: {
                    button: true
                }
            },
            position: {
                my: 'bottom center',
                at: 'top center',
                target: 'mouse',
                viewport: $('#fullcalendar'),
                adjust: {
                    mouse: false,
                    scroll: false
                }
            },
            show: false,
            hide: false,
            style: 'qtip-light'
        }).qtip('api');
    
        $('#fullcalendar').fullCalendar({
            editable: true,
            height: 600,
            header: {
                left: 'title',
                center: '',
                right: 'today prev,next'
            },
            eventMouseover : function(data, event, view) {
                var content = '<h3>'+data.title+'</h3>' + 
                    '<p><b>Start:</b> '+data.start+'<br />' + 
                    (data.end && '<p><b>End:</b> '+data.end+'</p>' || '');
    
                tooltip.set({
                    'content.text': content
                })
                .reposition(event).show(event);
            },
            dayClick: function() { tooltip.hide() },
            eventResizeStart: function() { tooltip.hide() },
            eventDragStart: function() { tooltip.hide() },
            viewDisplay: function() { tooltip.hide() },
            events: [
                {
                    title: 'All Day Event',
                    start: new Date(y, m, 1)
                },
                {
                    title: 'Long Event',
                    start: new Date(y, m, d-5),
                    end: new Date(y, m, d-2)
                },
                {
                    id: 999,
                    title: 'Repeating Event',
                    start: new Date(y, m, d+4, 16, 0),
                    allDay: false
                },
                {
                    title: 'Meeting',
                    start: new Date(y, m, d, 10, 30),
                    allDay: false
                },
                {
                    title: 'Birthday Party',
                    start: new Date(y, m, d+1, 19, 0),
                    end: new Date(y, m, d+1, 22, 30),
                    allDay: false
                }
            ]
        });
    }());
        });
    
    </script>
    
    0 讨论(0)
  • 2020-12-13 11:17

    heres my code

        $(document).ready(function() {
        // Setup FullCalendar
    // Setup FullCalendar
    (function() {
        var date = new Date();
        var d = date.getDate();
        var m = date.getMonth();
        var y = date.getFullYear();
    
        var tooltip = $('<div/>').qtip({
            id: 'fullcalendar',
            prerender: true,
            content: {
                text: ' ',
                title: {
                    button: true
                }
            },
            position: {
                my: 'bottom center',
                at: 'top center',
                target: 'mouse',
                viewport: $('#fullcalendar'),
                adjust: {
                    mouse: false,
                    scroll: false
                }
            },
            show: false,
            hide: false,
            style: 'qtip-light'
        }).qtip('api');
    
        $('#fullcalendar').fullCalendar({
            editable: true,
            height: 600,
            header: {
                left: 'title',
                center: '',
                right: 'today prev,next'
            },
            eventMouseover : function(data, event, view) {
                var content = '<h3>'+data.title+'</h3>' + 
                    '<p><b>Start:</b> '+data.start+'<br />' + 
                    (data.end && '<p><b>End:</b> '+data.end+'</p>' || '');
    
                tooltip.set({
                    'content.text': content
                })
                .reposition(event).show(event);
            },
            dayClick: function() { tooltip.hide() },
            eventResizeStart: function() { tooltip.hide() },
            eventDragStart: function() { tooltip.hide() },
            viewDisplay: function() { tooltip.hide() },
            events: [
                {
                    title: 'All Day Event',
                    start: new Date(y, m, 1)
                },
                {
                    title: 'Long Event',
                    start: new Date(y, m, d-5),
                    end: new Date(y, m, d-2)
                },
                {
                    id: 999,
                    title: 'Repeating Event',
                    start: new Date(y, m, d+4, 16, 0),
                    allDay: false
                },
                {
                    title: 'Meeting',
                    start: new Date(y, m, d, 10, 30),
                    allDay: false
                },
                {
                    title: 'Birthday Party',
                    start: new Date(y, m, d+1, 19, 0),
                    end: new Date(y, m, d+1, 22, 30),
                    allDay: false
                }
            ]
        });
    }());
        });
    
    </script>
    
    0 讨论(0)
  • 2020-12-13 11:22

    Use Bootstrap tooltip plugin http://getbootstrap.com/javascript/#tooltips . And then inside eventRender callback write following:

     eventRender: function(event, element) {
          $(element).tooltip({title: event.title});             
      }
    

    This will work

    enter image description here

    0 讨论(0)
  • 2020-12-13 11:25

    In version 4 of FullCalendar, there is only one argument: eventRender: function (info)

    so the snippet is:

    eventRender: function (info) {
      $(info.el).tooltip({ title: info.event.title });     
    }
    
    0 讨论(0)
  • 2020-12-13 11:26

    Updated answer based on @Divyank Sabhaya's solution to work on v4

    eventMouseEnter: function(calEvent) {
    var tooltip = '<div class="tooltipevent" style="width:auto;height:20px;vertical-align:middle;background:'+calEvent.el.style.backgroundColor+';position:absolute;z-index:10001;">' + calEvent.event._def.extendedProps.description + '</div>';
    $("body").append(tooltip);
    $(this.el).mouseover(function(e) {
        $(this.el).css('z-index', 10000);
        $('.tooltipevent').fadeIn('500');
        $('.tooltipevent').fadeTo('10', 1.9);
    }).mousemove(function(e) {
        $('.tooltipevent').css('top', e.pageY + 10);
        $('.tooltipevent').css('left', e.pageX + 20);
    });},
    
    eventMouseLeave: function(calEvent, jsEvent) {
     $(this.el).css('z-index', 8);
     $('.tooltipevent').remove();},
    

    best

    0 讨论(0)
  • 2020-12-13 11:31
    eventMouseover: function(calEvent, jsEvent) {
        var tooltip = '<div class="tooltipevent" style="width:100px;height:100px;background:#ccc;position:absolute;z-index:10001;">' + calEvent.title + '</div>';
        $("body").append(tooltip);
        $(this).mouseover(function(e) {
            $(this).css('z-index', 10000);
            $('.tooltipevent').fadeIn('500');
            $('.tooltipevent').fadeTo('10', 1.9);
        }).mousemove(function(e) {
            $('.tooltipevent').css('top', e.pageY + 10);
            $('.tooltipevent').css('left', e.pageX + 20);
        });
    },
    
    eventMouseout: function(calEvent, jsEvent) {
         $(this).css('z-index', 8);
         $('.tooltipevent').remove();
    },
    
    0 讨论(0)
提交回复
热议问题