代码之家  ›  专栏  ›  技术社区  ›  Andre Gallo

jQuery UI日期选择器CSS问题

  •  3
  • Andre Gallo  · 技术社区  · 16 年前

    我有一个非常简单的HTML页面,带有jQuery日期选择器:

        <!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>
    

    日期选择器本身似乎工作得很好,但我无法应用我的主题。我是不是错过了一些很愚蠢的事情?

    4 回复  |  直到 16 年前
        1
  •  8
  •   bart    6 年前

    如果通过Google加载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,那么数据采集器将不会显示。

        2
  •  7
  •   Andre Gallo    16 年前

    谢谢

        3
  •  3
  •   vkrams rolling stone    14 年前

    我遇到了和你相反的问题。我忘了在我的头部分插入下面的行,我的日期选择器从我的模板中获取css。在我的head部分中包含它之后,我可以使用googleapi的css查看日期时间选择器

    <link href="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8/themes/base/jquery-ui.css" rel="stylesheet" type="text/css">
    
        4
  •  0
  •   Saiful Islam    8 年前

    让我们试试这个。。。

            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));