2009-01-20 51 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));