添加到WordPress主题时Bootstrap datepicker和timepicker不工作

时间:2012-10-19 16:00:07

标签: wordpress twitter-bootstrap datepicker timepicker

真的希望你可以帮我解决这个问题,我迷失了......

我已将bootstrap-datepicker.jsbootstrap-timepicker.js添加到主题的js文件夹中,并将相关的css文件添加到css / bootstrap文件夹中。

我修改了functions.php以将脚本和样式表排入队列:

wp_enqueue_script('bootstrap-js', get_template_directory_uri() .'/js/bootstrap.js');
wp_enqueue_script('bootstrap-datepicker', get_template_directory_uri() .'/js/bootstrap-datepicker.js');
wp_enqueue_script('bootstrap-fileupload', get_template_directory_uri() .'/js/bootstrap-fileupload.js');
wp_enqueue_script('bootstrap-timepicker', get_template_directory_uri() .'/js/bootstrap-timepicker.js');

wp_enqueue_style('bootstrap', get_template_directory_uri().'/css/bootstrap/bootstrap.css');
wp_enqueue_style('responsive', get_template_directory_uri().'/css/bootstrap/bootstrap-responsive.css');
wp_enqueue_style('bootstrap-datepicker', get_template_directory_uri().'/css/bootstrap/bootstrap-datepicker.css');
wp_enqueue_style('bootstrap-fileupload', get_template_directory_uri().'/css/bootstrap/bootstrap-fileupload.css');
wp_enqueue_style('bootstrap-timepicker', get_template_directory_uri().'/css/bootstrap/bootstrap-timepicker.css');

对象显示正确,但点击它们时没有任何反应。我用下面的HTML(每个作者网站的示例代码)调用它们:

<div class="input-append date" id="datepicker" data-date="12-02-2012" data-date-format="dd-mm-yyyy">
    <input class="span2" size="16" type="text" value="12-02-2012">
    <span class="add-on"><i class="icon-th"></i></span>
</div>

<div class="input-append bootstrap-timepicker-component">
    <input type="text" class="timepicker-default input-small">
    <span class="add-on">
        <i class="icon-time"></i>
    </span>
</div> 

当我检查Chrome中的元素时,我可以看到CSS就在那里,脚本存在于资源&gt;脚本部分。网站上的其他一切都运行正常。

0 个答案:

没有答案