English 中文(简体)
iii 不得在语言范围内工作
原标题:jQuery not working within Wordpress

I have this bit of jQuery script that can be found here: http://jsfiddle.net/RUqNN/45/

当我把这一文字纳入我的字句模板时,我不做任何工作。

我检查垃圾源的链接,重新起草法典,没有任何效果。

<html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
</head>
    <body>
      <script type="text/javascript">
        $(document).ready(function() {
          $(".move").toggle(
            function() {
              $("#teetimetag").animate({
                right: "0px"
              }, "normal");
            },function() {
              $("#teetimetag").animate({
                right: "-200px"
              }, "normal");
          });
        });
    </script>
      <div id="teetimetag">
         <img class="move" src="http://test.tooheavytoskydive.com/wp-content/themes/newtheme/images/flag.png" style="float: left;" />
        <div style="margin: 15px 0 0 50px;">
          <a href="http://test.tooheavytoskydive.com/reservations/" style="color: #FFF; font-weight: bold; font-size: 17px;">Reserve your Tee-Time</a>
        </div>
      </div>
    </body>
    </html>
最佳回答

您的网站有以下小字母错误:美元不是一个功能。 它像“Query”与其他一些图书馆发生冲突。 可以通过叫jQuery.noConflict()和用j Query(j Query)来解决这一问题。 该法典将研究如下:

jQuery.noConflict();
jQuery(document).ready(function() {
          jQuery(".move").toggle(
            function() {
              jQuery("#teetimetag").animate({
                right: "0px"
              }, "normal");
            },function() {
              jQuery("#teetimetag").animate({
                right: "-200px"
              }, "normal");
          });

});
问题回答

您应在模板职能中登记 j。 php file:

wp_register_script( jquery ,  http://code.jquery.com/jquery-1.7.2.min.js );

http://codex.wordpress.org/Function_Reference/wp_register_script”rel=“nofollow”>http://codex.wordpress.org/Function_Reference/wp_register_script

作为一般规则,你不应使用<条码>变量><条码>。 简历 页: 1 The following is an example of how to shortcut jQuery to safe use thecode>$ps:

jQuery(function ($) {
    /* You can safely use $ in this code block to reference jQuery */
});

To load jquery at wordpress use the either one of the following 2 versions. Include the code at Plugin Page OR at function.php

function include_jQuery() {
    if (!is_admin()) {
        wp_enqueue_script( jquery );
    }
}
add_action( init ,  include_jQuery );

具体地说,你可以使用任何有意义的职务名称,而不是<条码>,include_jQuery。

或者,你可以使用以下法典:

function include_jQuery() {
    if (!is_admin()) {
        // comment out the next two lines to load the local copy of jQuery
        wp_deregister_script( jquery ); 
        wp_register_script( jquery ,  http://ajax.googleapis.com/ajax/libs/jquery/1.8.3/jquery.min.js , false,  1.8.3 ); 
        wp_enqueue_script( jquery );
    }
}
add_action( init ,  include_jQuery );

页: 1 THIS链接以及我个人从哪里学习上述技术。 A Very BIG 感谢<> Ericm Martin!





相关问题
selected text in iframe

How to get a selected text inside a iframe. I my page i m having a iframe which is editable true. So how can i get the selected text in that iframe.

How to fire event handlers on the link using javascript

I would like to click a link in my page using javascript. I would like to Fire event handlers on the link without navigating. How can this be done? This has to work both in firefox and Internet ...

How to Add script codes before the </body> tag ASP.NET

Heres the problem, In Masterpage, the google analytics code were pasted before the end of body tag. In ASPX page, I need to generate a script (google addItem tracker) using codebehind ClientScript ...

Clipboard access using Javascript - sans Flash?

Is there a reliable way to access the client machine s clipboard using Javascript? I continue to run into permissions issues when attempting to do this. How does Google Docs do this? Do they use ...

javascript debugging question

I have a large javascript which I didn t write but I need to use it and I m slowely going trough it trying to figure out what does it do and how, I m using alert to print out what it does but now I ...

Parsing date like twitter

I ve made a little forum and I want parse the date on newest posts like twitter, you know "posted 40 minutes ago ","posted 1 hour ago"... What s the best way ? Thanx.

热门标签