2011-01-18 24 views
2

我一直試圖在我的wordpress主題中包含jQuery UI效果(更具體的搖動效果)。到目前爲止,我只能包含jQuery腳本,但我真的不知道應該在哪裏放置ui腳本以及如何排隊。如何在wordpress上正確包含jquery-ui效果

這是我的代碼。它顯然不工作:

<?php wp_enqueue_script("jquery"); ?> 
<?php wp_enqueue_script("jquery-ui-core"); ?> 
<?php wp_head(); ?> 
<link rel="stylesheet" type="text/css" href="<?php bloginfo('stylesheet_url'); ?>" /> 
<script type="text/javascript"> 
    var $j = jQuery.noConflict(); 
    $j(document).ready(function() { 
     $j("#manita-imagen").mouseover(function(){ 
      //$j(this).animate({ opacity: "hide" }) 
      // alert('asd'); 
      $j(this).effect("shake", { times:3 }, 300); 
     }); 
    }); 

</script> 

感謝您的幫助!

+1

我無法回答你的問題(因此評論),但你可能能夠在[Wordpress Stack Exchange站點](http://wordpress.stackexchange.com/)上找到Wordpress特定的幫助。 – 2011-01-18 22:21:54

+0

我也會在這裏添加這個問題,謝謝! – dabito 2011-01-18 22:39:21

回答

7

包含在wordpress中的jquery-ui-core可能不包含效果。文檔不清楚(http://codex.wordpress.org/Function_Reference/wp_enqueue_script#Default_scripts_included_with_WordPress)您可能需要從url加載自定義jquery-ui軟件包。下面將從谷歌完全加載jQuery UI的CDN

<?php wp_enqueue_script("myUi","https://ajax.googleapis.com/ajax/libs/jqueryui/1.8.8/jquery-ui.min.js"); ?>

您也可以使用wp_enqueue_script($名稱,$ SRC)函數來加載自己的腳本。

相關問題