最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

javascript - Unable to use glyphicon in next&prev buttons of fullcalendar - Stack Overflow

programmeradmin1浏览0评论

I'm trying to change a style of next, previous buttons of fullcalendar by using a glyphicon.

Here is my code:

$(document).ready(function() {
  $('#calendar').fullCalendar({
      buttonText : {
          prev : '<i class="glyphicon glyphicon-triangle-left"></i>',
          next : '<i class="glyphicon glyphicon-triangle-right"></i>'
      }
  });
});

It's not working. It's shown like this:

And here is a rendered html code,

I didn't know what was wrong. Thanks a lot for your help.

I'm trying to change a style of next, previous buttons of fullcalendar by using a glyphicon.

Here is my code:

$(document).ready(function() {
  $('#calendar').fullCalendar({
      buttonText : {
          prev : '<i class="glyphicon glyphicon-triangle-left"></i>',
          next : '<i class="glyphicon glyphicon-triangle-right"></i>'
      }
  });
});

It's not working. It's shown like this:

And here is a rendered html code,

I didn't know what was wrong. Thanks a lot for your help.

Share Improve this question edited Jul 2, 2015 at 9:47 uraimo 19.9k8 gold badges50 silver badges57 bronze badges asked Jul 2, 2015 at 9:43 Hikaru ShindoHikaru Shindo 2,9239 gold badges40 silver badges70 bronze badges
Add a ment  | 

2 Answers 2

Reset to default 5

Maybe prev and next are only expected text. And even if there are html tags, they are considered as text. Did you tried to add these icon in javascript after the creation of the calendar?

Like:

...
$('#calendar').fullCalendar({
  buttonText : {
      prev : '<i class="glyphicon glyphicon-triangle-left"></i>',
      next : '<i class="glyphicon glyphicon-triangle-right"></i>'
  }
});
$(".fc-prev-button").append('<i class="glyphicon"...</i>')
...

That seems to set the text content of the button, while you want to use a custom css class to display a custom icon.

Have you tried using buttonsIcons instead?

$('#calendar').fullCalendar({
    buttonsIcons : {
       prev: 'left-single-arrow',
       next: 'right-single-arrow',
    }
});

I'm not pletely sure that you can use custom named css classes, some posts seem to hint to the fact that it could not be that easy.

发布评论

评论列表(0)

  1. 暂无评论