datepicker缺少Bootstrap导航箭头

时间:2016-07-25 15:12:52

标签: javascript html css twitter-bootstrap datepicker

我意识到有类似的问题,问题是没有引用正确的字体系列。但是,在我使用的版本中,他们没有使用导航箭头的图标,他们使用html字符代码表示双左箭头和双右箭头。

我的HTML参考资料 -

<link href="Content/css/bootstrap.css" rel="stylesheet" />
<link href="Content/css/datepicker.css" rel="stylesheet" />
<link href="Content/css/navbar.css" rel="stylesheet" />
<link href="Content/css/jquery-ui.min.css" rel="stylesheet" />
<link href="Content/css/jquery-ui.structure.min.css" rel="stylesheet" />
<link href="Content/css/jquery-ui.theme.min.css" rel="stylesheet" />

<script type= "text/javascript" src="Scripts/jquery-2.2.0.min.js"></script>
<script type= "text/javascript" src="Scripts/bootstrap.min.js"></script>
<script type= "text/javascript" src="Scripts/bootstrap-datepicker.js"></script>
<script type= "text/javascript" src="Scripts/moment.min.js"></script>
<script type= "text/javascript" src="Scripts/jquery-ui.min.js"></script>


<script type="text/javascript">
    $(document).ready(function () {
        $(".datepicker").datepicker({
            format: 'dd/mm/yyyy',
            autoclose: true,
            todayBtn: 'linked',
            useCurrent: true,
            ignoreReadonly: true
        })
    });
</script>

以下是bootstrap-datepicker.js文件中的相关编码 -

    headTemplate: '<thead>'+
                      '<tr>'+
                        '<th colspan="7" class="datepicker-title"></th>'+
                      '</tr>'+
                        '<tr>'+
                            '<th class="prev">&laquo;</th>'+
                            '<th colspan="5" class="datepicker-switch"></th>'+
                            '<th class="next">&raquo;</th>'+
                        '</tr>'+
                    '</thead>',
    contTemplate: '<tbody><tr><td colspan="7"></td></tr></tbody>',
    footTemplate: '<tfoot>'+
                        '<tr>'+
                            '<th colspan="7" class="today"></th>'+
                        '</tr>'+
                        '<tr>'+
                            '<th colspan="7" class="clear"></th>'+
                        '</tr>'+
                    '</tfoot>'
};

我得到的是与一般标题背景相同的灰色,然后是正常的蓝色&#34;悬停&#34;正如我在日历上的任何一天所做的那样。

Naughty datepicker

我寻找冲突的&#34; .prev&#34;其他.css文件中的定义,但没有看到表,datepicker或标题的任何特定内容。我也尝试使用glyphicons替换编码,结果相同。

我的jfiddle -

JFiddle Coding samples

3 个答案:

答案 0 :(得分:5)

我已经解决了它:

<script>
$(document).ready( function(){

  $('#datepicker').datepicker({
    minDate: "01/01/1965",
    maxDate: "12/31/2005",
    startDate: "01/01/1965",
    endDate:    "12/31/2005",
    changeYear: true,
    changeMonth: true,
    autoclose: true
  });

  $('.prev i').removeClass();
  $('.prev i').addClass("fa fa-chevron-left");

  $('.next i').removeClass();
  $('.next i').addClass("fa fa-chevron-right");

});

删除标签的类,然后分配一个字体很棒的箭头类

答案 1 :(得分:1)

根据您提供的Fiddle,看起来jQuery UI就是问题所在。它覆盖了.datepicker课程的元素,并将.prev.next中的文字替换为基于图像的图标,其相对路径在您的构建中无效。

您的解决方案是添加适当的图像(根据您对上面选择的评论的响应),或确保jQuery UI不会挂钩到您的Datepicker。

答案 2 :(得分:0)

这可能是因为找不到这些箭头的图标。

  1. 转到bootstrap-datetimepicker.min.js并搜索图标

    def odd_sort(numbers, lock):
    
    
        N = len(numbers)
        for i in range(1, N-1, 2):
            lock.acquire()
            if numbers[i] > numbers[i+1]: 
                numbers[i], numbers[i+1] = numbers[i+1], numbers[i] 
                global isSorted
                isSorted = True
            
            lock.release()
    
    
    
    def even_sort(numbers, lock):
    
    
        N = len(numbers)
        for i in range(0, N-1, 2):
            lock.acquire()
            if numbers[i] > numbers[i+1]: 
                numbers[i], numbers[i+1] = numbers[i+1], numbers[i] 
                global isSorted
                isSorted = True
            
            lock.release()
    
    
    
    def Multiprocessing(numbers):
    
    
        Start_time = time.time()
        
        #p = Pool(os.cpu_count())
        print('cpu count is : ' + str(os.cpu_count()))
        
        lock = Lock()
        global numbers
        global isSorted
        
        while isSorted == True:
            
            isSorted = False
    
            
            
            # creat 2 process objects for each function
            odd = Process(target=odd_sort, args=(numbers, lock))
            even = Process(target=even_sort, args=(numbers, lock))
    
            odd.start()
            even.start()
    
            odd.join()
            even.join()
    
            print(numbers)
    
  2. 确保这两个类具有它们的值出现在上面列表中的样式

    icons: { time: "glyphicon glyphicon-time", date: "glyphicon glyphicon- 
    calendar", up: "glyphicon glyphicon-chevron-up", down: "glyphicon glyphicon- 
    chevron-down", previous: "glyphicon glyphicon-chevron-left", next: "glyphicon 
    glyphicon-chevron- right", today: "glyphicon glyphicon-screenshot", clear: 
    "glyphicon glyphicon- trash", close: "glyphicon glyphicon-remove" }, 
    
    
    
  3. 如果第 2 步不起作用,请尝试将 glyhpicon 更改为其他图标