Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/html/85.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Jquery切换在Live网站中不起作用_Jquery_Html - Fatal编程技术网

Jquery切换在Live网站中不起作用

Jquery切换在Live网站中不起作用,jquery,html,Jquery,Html,我正试图用jquery创建一个带有社交按钮的toggle类,但当我将它添加到我的网站时,它不起作用,尽管在JSFIDLE中工作得很好 这是我的,这是我的,所以你可以检查它是否不工作。 在视频下面 我不知道我做错了什么,我已将此添加到头文件: <script src="//code.jquery.com/jquery-1.10.2.js"></script> <script type="text/javascript"> $( "#clickme" ).clic

我正试图用jquery创建一个带有社交按钮的toggle类,但当我将它添加到我的网站时,它不起作用,尽管在JSFIDLE中工作得很好

这是我的,这是我的,所以你可以检查它是否不工作。 在视频下面

我不知道我做错了什么,我已将此添加到头文件:

<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script type="text/javascript">
$( "#clickme" ).click(function() {
  $( "#share-stuff" ).slideToggle( "slow", function() {
    // Animation complete.
  });
});

</script>

$(“#单击我”)。单击(函数(){
$(“#共享内容”).slideToggle(“慢”,函数(){
//动画完成。
});
});
这是我希望类出现的地方:

<div id="clickme">
    Partilhar
</div>
<div id="share-stuff"> <!-- social share buttons -->
    <ul class="crafty-social-buttons-list">
        <li><a class="crafty-social-button csb-facebook" href="http://www.facebook.com/sharer/sharer.php?u=<?php the_permalink() ?>" target="_blank"><img title="Facebook" alt="Facebook" width="38" height="38" src="../tv/wp-content/themes/trademark/share-buttons/facebook.png"></a></li>
        <li><a class="crafty-social-button csb-google" href="https://plus.google.com/share?url=<?php the_permalink() ?>" target="_blank"><img title="Google" alt="Google" width="38" height="38" src="../tv/wp-content/themes/trademark/share-buttons/google.png"></a></li>
        <li><a class="crafty-social-button csb-twitter" href="http://twitter.com/share?url=<?php the_permalink() ?>" target="_blank"><img title="Twitter" alt="Twitter" width="38" height="38" src="../tv/wp-content/themes/trademark/share-buttons/twitter.png"></a></li>
        <li><a class="crafty-social-button csb-reddit" href="http://reddit.com/submit?url=<?php the_permalink() ?>" target="_blank"><img title="Reddit" alt="Reddit" width="38" height="38" src="../tv/wp-content/themes/trademark/share-buttons/reddit.png"></a></li>
    </ul>
</div>

游击队
另外,如何使其开始关闭而不是打开?

尝试使用

另外,要关闭
share stuff
onload,请先隐藏它:

尝试使用

另外,要关闭
share stuff
onload,请先隐藏它:


在dom上呈现clickme项目之前,您正在尝试绑定该项目。将jquery代码移动到文档末尾。最好用文档准备好的代码包装它们,比如

$(document).ready(function() {

// your jquery codes

});

在dom上呈现clickme项目之前,您正在尝试绑定该项目。将jquery代码移动到文档末尾。最好用文档准备好的代码包装它们,比如

$(document).ready(function() {

// your jquery codes

});
您必须以上述方式包装jquery,并且页面上似乎有错误,请同时检查这两个错误


您必须以上述方式包装jquery,并且页面上似乎有错误,请检查两者。

@Dom他正在绑定文档标题上的单击事件。这就是为什么它在小提琴中工作,而不是在他的项目中。什么是OP?对不起,只读最后一个问题。您是对的。@Dom他正在绑定文档标题上的单击事件。这就是为什么它在小提琴中工作,而不是在他的项目中。什么是OP?对不起,只读最后一个问题。你说得对。
$(document).ready(function() {

// your jquery codes

});