2012-02-25 56 views
0

如何在頁面加載後加載jQuery對話框?我的意思是我不想每次刷新頁面時加載它。如何使用wp_enqueue_script在wordpress中加載jquery對話框?

我知道這是關於餅乾。

這裏是我的對話框

var $j = jQuery.noConflict(); 

$j(function(){ 

    $j(document).ready(function(){ 

     $j('#west').dialog({show: 'slow', modal: true, height: 600, width: 850, title: 'Price Comparison Popup', resizable: false, draggable: false});   
     });   

    }); 
+1

我不明白這和wp_enqueue_script有什麼關係。另外,您正在文檔就緒功能中打包文檔就緒功能。你只需要一個。 ;-) – 2012-02-25 01:56:27

+0

@Ronny:「我知道這跟餅乾有關。」不,你不知道。 – 2012-02-25 02:34:52

回答

1

我不知道我完全理解你的問題,但如果你只是想一個jQuery UI的腳本添加到您的代碼,使用類似:

//assuming you are working on a plugin 
$plugin_url = plugins_url('myPlugin'); 
//register and enqueue the script 
wp_register_script("jquery-dialog", $plugin_url . '/js/jquery.dialog.js', 'jquery'); 
wp_enqueue_style('jquery-dialog'); 

這將包括腳本,並確保它在WordPress的jQuery版本之後加載。