简体   繁体   中英

FullCalendar custom button icon not showing

  $('#calendar').fullCalendar({ header: { left: /*'prev,next'*/'BackwardButton,ForwardButton', center: 'title', right: '', }, customButtons: { ForwardButton: { //text: 'Framåt', click: function () { } }, BackwardButton: { //text: 'Bakåt', click: function () { } } }, buttonsIcons: { BackwardButton: 'left-single-arrow', ForwardButton: 'right-single-arrow', }, }); 
 <link href="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.9.0/fullcalendar.css" rel="stylesheet"/> <script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.0/moment.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/fullcalendar/3.9.0/fullcalendar.js"></script> <div id="calendar"></div> 

I am working with FullCalender.io . I have two custom buttons that I would like to add the default chevron or arrow to. I found these properties , but I can't figure out where in the full calendar initialization I should put it. Nothing have worked so far. I only get the text 'undefined'. Any ides anybody?

      jQuery('#calendar').fullCalendar({
            header: {
                left: 'BackwardButton,ForwardButton',
                center: 'title',
                right: '',
            },             
            customButtons: {                    
                ForwardButton: {
                    //text: 'Framåt',
                    click: function () {

                    }
                },
                BackwardButton: {
                    //text: 'Bakåt',
                    click: function () {

                }
            },
            buttonsIcons: {
                BackwardButton: 'left-single-arrow',
                ForwardButton: 'right-single-arrow',
            }
        });

Edit: the code below works, however OP's code was correct barring a typo (should have been buttonIcons instead of buttonsIcons ). See @ADyson's JSFiddle here: http://jsfiddle.net/sbxpv25p/510/

Original:

I think this might be what you're after: https://codepen.io/anon/pen/KoLZXq

It looks like you were trying to add the icons in the wrong place:

$("#calendar").fullCalendar({
    header: {
        left: "BackwardButton, ForwardButton",
        center: "title"
    },
    customButtons: {
        ForwardButton: {
            icon: "right-single-arrow",
            click: function() {}
        },
        BackwardButton: {
            icon: "left-single-arrow",
            click: function() {}
        }
    }
})

Note how each button has an icon property now.

这可能是您需要的全日历选项

themeSystem:'standard' 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM