Bootstrap-Year-Calendar showing all the months Ver

2019-07-31 01:16发布

问题:

I have implemented the Bootstrap-Year-Calendar plug-in but it appears vertically, I don't know if it has to do anything with my scripts or links. I tried changing the version of my Jquery and bootstrap version but the result is the same.

I was following these instructions:http://www.bootstrap-year-calendar.com/#Documentation/Installation

This is my code:

<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <!-- Bootstrap css-->

    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">

    <link rel="stylesheet" href="{{ static_url('css/bootstrap.min.css') }}">

    <!-- CUSTOM & PAGES STYLE -->
    <link rel="stylesheet" href="{{ static_url('css/custom.css') }}">


</head>

<body>

<div class="container">
<div data-provide="calendar" class="calendar">

    </div>      
</div>


<!-- Bootsrap -->
<script src="https://code.jquery.com/jquery-2.2.4.js" integrity="sha256-iT6Q9iMJYuQiMWNd9lDyBUStIq/8PuOW33aOqmvFpqI=" crossorigin="anonymous"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.3/umd/popper.min.js" integrity="sha384-ZMP7rVo3mIykV+2+9J3UJ46jBk0WLaUAdn689aCwoqbBJiSnjAK/l8WvCWPIPm49" crossorigin="anonymous"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/js/bootstrap.min.js" integrity="sha384-ChfqqxuZUCnJSK3+MXmPNIyE6ZbWh2IMqE241rYiqJxyMiZ6OW/JmZQ5stwEULTy" crossorigin="anonymous"></script>

<link rel="stylesheet" href="{{ static_url('css/bootstrap-year-calendar.min.css') }}">
<script src="{{ static_url('js/bootstrap-year-calendar.min.js') }}"></script>

<script>
$(function() {
    $('#calendar').calendar();
});
</script>
</body>

</html>

This is how it looks now

回答1:

This is because you're using bootstrap 4. Bootstrap-Year-Calendar works with Bootstrap 3 versions only. If you can't use bootstrap3 in your site there is a fork customized for BS4.

From fork authors comment:- He has Migrated the classes that relied on deprecated BS3 classes and it should work. BS4 no longer uses glyphicons,So he used open-iconic as a dependency, as it was one of their recommended sources for icons (https://getbootstrap.com/docs/4.0/extend/icons/)

Disclaimer: I have no connection with both library and its fork.