如何在源文件中未显示的tempus-dominus(datetimepicker)中编辑类?

时间:2019-08-10 17:39:33

标签: twitter-bootstrap bootstrap-4 datetimepicker bootstrap-datetimepicker tempus-dominus-datetimepicker

我想例如更改tempus-dominus(https://tempusdominus.github.io/bootstrap-4/)的.day类,但是即使使用!important,它在检查时似乎也不起作用(请不要四处点击,因为对其进行检查很奇怪。即使在强制:hover时,下拉列表也会消失。

假设我要将.day的字体大小从90%更改为100%

源代码:https://tempusdominus.github.io/bootstrap-4/theme/css/tempusdominus-bootstrap-4.css

找到下面的代码=)

在此先感谢您的帮助!

<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Tempus Dominus</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="" />
<meta name="keywords" content="" />

<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" />
<link rel="stylesheet" href="https://netdna.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.css" />
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/9.9.0/styles/github.min.css" />
<link rel="stylesheet" href="https://tempusdominus.github.io/bootstrap-4/theme/css/tempusdominus-bootstrap-4.css" />

<style>
  /*
  .bootstrap-datetimepicker-widget table td {
  color: red;
  }
  */
}
</style>

</head>

  <body>
    <script src="https://momentjs.com/downloads/moment.min.js"></script>
    <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
    <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/tempusdominus-bootstrap-4/5.0.0-alpha14/js/tempusdominus-bootstrap-4.min.js"></script>


    <div class="container">
      <div class="row">
        <div class="col-sm-6">
          <input type="text" class="form-control datetimepicker-input" id="datetimepicker5" data-toggle="datetimepicker" data-target="#datetimepicker5" />
        </div>
        <script type="text/javascript">
          $(function() {
            $('#datetimepicker5').datetimepicker();
          });
        </script>
      </div>
    </div>

  </body>
</html>

1 个答案:

答案 0 :(得分:1)

为了调试插件,您可以添加一个debugger调用,例如:

$('#datetimepicker5').on('hide.datetimepicker', function(e) {
     $('#datetimepicker5').datetimepicker('show');
     debugger;
});

如果您需要为 day 类的所有单元格更改font-size,则可以:

.bootstrap-datetimepicker-widget table td.day {
    font-size: 80%;
}

$('#datetimepicker5').datetimepicker();

$('#datetimepicker5').on('show.datetimepicker', function(e) {
    //$('#datetimepicker5').datetimepicker('show');
    //debugger;
});
.bootstrap-datetimepicker-widget table td.day {
  font-size: 80%;
}
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
<link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
<link rel="stylesheet" href="https://use.fontawesome.com/releases/v5.7.2/css/all.css" >
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/tempusdominus-bootstrap-4/5.0.1/css/tempusdominus-bootstrap-4.min.css" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/moment.js/2.22.2/moment.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/tempusdominus-bootstrap-4/5.0.1/js/tempusdominus-bootstrap-4.min.js"></script>


<div class="container">
    <div class="row">
        <div class="col-sm-6">
            <input type="text" class="form-control datetimepicker-input" id="datetimepicker5" data-toggle="datetimepicker" data-target="#datetimepicker5" />
        </div>
    </div>
</div>