I have the following script working on my site at www.riscograma.ro, to hide the comments section unless told otherwise:
jQuery(function($) {
$( #comments ).hide();
$( #showcomments ).click(function(e) {
if($( #comments ).is( :hidden )) {
$( #comments ).show();
} }); });
The problem is that links to individual comments or to the reply form can no longer point where they should, because the target is hidden.
我估计,如果尿液中没有根基(#)的话,就只能执行文字。 我尝试增加以下线(和改动):
jQuery(function($) {
if(window.location.hash.indexOf("#")==0) {
$( #comments ).hide(); }
$( #showcomments ).click(function(e) {
if($( #comments ).is( :hidden )) {
$( #comments ).show();
} }); });
但它没有工作(即评论在任何时候都可以看到)。
What am I doing wrong?