2009-01-20 53 views
3

我有了这个非常简单的HTML页面,一个jQuery的日期选择器:的jQuery UI的日期选择器的CSS问题

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head> 
    <title>jQuery Datepicker</title> 
    <link rel="stylesheet" href="../App_Themes/Default/ui.datepicker.css" type="text/css" 
     media="screen" title="Smoothness" /> 

    <script src="../Shared/Scripts/jquery-1.2.6.min.js" type="text/javascript"></script> 

    <script src="../Shared/Scripts/jquery-ui-1.5.3.min.js" type="text/javascript"></script> 

    <script language="javascript" type="text/javascript"> 
     $(document).ready(PageLoad); 

     function PageLoad() { 
      $('#textBox').datepicker(); 
     } 
    </script> 

</head> 
<body> 
    <input type="text" id="textBox" /> 
</body> 
</html> 

的日期选择器本身似乎完美地工作,但我不能将我的主题。我在这里错过了一些非常愚蠢的东西吗?

谢谢!

+0

它工作正常的我。检查你的路径和CSS的有效性。 – kgiannakakis 2009-01-20 07:04:59

回答

6

我的问题不是关于CSS有效性或相对路径....我只是引用了我的jQuery-ui版本的错误版本的CSS文件。对于所有出现类似问题的人,请确保您为jQuery-ui脚本下载了正确的主题版本。

谢谢。

+3

当你意识到自己知道你一直在做什么但是在执行的某个地方失败时,它是一种伟大/可怕的感觉:) – Birk 2009-01-21 14:24:14

3

我得到了与你相反的问题。其中我忘了将下面的行插入我的头部分,并且我的datepicker正在从我的模板中获取css。包括在我的头上节之后,我可以能够与googleapi的CSS

<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"> 
6

如果你通过谷歌加载jQueryUI的,确保jQueryUI的CSS主题具有相同的版本jQueryUI的图书馆中的日期时间选择器。

<link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/themes/base/jquery-ui.css" rel="stylesheet" type="text/css"/> 

<script src='https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.5/jquery-ui.min.js' type='text/javascript'></script> 

检查上面的代码,都使用1.8.5。但是如果你为主题加载1.8而不是1.8.5,则数据贴图不会显示。

0

让我们试试这个...

 function eds_admin_styles() { 
      wp_enqueue_style('jquery-ui-datepicker-style' , '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.4/themes/smoothness/jquery-ui.css'); 
     } 
     add_action('admin_print_styles', 'eds_admin_styles'); 
     function eds_admin_scripts() { 
      wp_enqueue_script('jquery-ui-datepicker'); 
     } 
     add_action('admin_enqueue_scripts', 'eds_admin_scripts'); 

这里是JS

(function($) { 
     $('#jquery-datepicker').datepicker(); 
    }(jQuery));