【问题标题】:How to correctly include jquery-ui effects on wordpress如何在 wordpress 上正确包含 jquery-ui 效果
【发布时间】:2011-01-18 22:18:14
【问题描述】:

我一直在尝试在我的 wordpress 主题中包含 jquery ui 效果(更具体地说是抖动效果)。到目前为止,我只能包含 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>

感谢您的帮助!

【问题讨论】:

  • 我无法回答您的问题(因此发表评论),但您可以在 Wordpress Stack Exchange site 上找到特定于 Wordpress 的帮助。
  • 我也会把这个问题加在那里,谢谢!
  • 没问题,我很抱歉我不能提供更多帮助 =)

标签: jquery wordpress jquery-ui


【解决方案1】:

wordpress 附带的 jquery-ui-core 可能不包含 Effects。文档不清楚(http://codex.wordpress.org/Function_Reference/wp_enqueue_script#Default_scripts_included_with_WordPress) 您可能需要从 url 加载自定义 jquery-ui 包。下面将从 google cdn 加载完整的 jquery UI

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

您也可以使用 wp_enqueue_script($name, $src) 函数来加载您自己的脚本。

【讨论】:

猜你喜欢
  • 1970-01-01
  • 2019-07-25
  • 1970-01-01
  • 2011-02-23
  • 2015-09-16
  • 2014-02-10
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多