English 中文(简体)
只有在母体内没有封顶标志时,才会佩带。
原标题:only execute script when url does not contain anchor sign

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?

最佳回答

-1>。 如未发现,<代码>0将表示其载于索引0

问题回答

暂无回答




相关问题
VS 10 mangles html comments?

Using the latest VS 10 we created html markup, then commented it with html comments. The file on disk is not mangled, but when it renders, it renders the html comment tags, then removes some of the ...

Comments & OpenSource software [closed]

This may sound like a foolish question or an observation, but i have seen that most of the times when one tries to look at the opensource code, there are no comments or just one or two lines at the ...

Including commented Class declaration in implementation file

Everyone knows the advantages of a more readable code. So in order to make my code more readable what i do normally is include the commented class declaration in the implementation file of that class....

pair programming with comments [closed]

Over the years, I ve discovered that green-programmers tend to read the comments rather than the code to debug issues. Does having one person document the other person s code (and vice-versa) with ...

Commenting JavaScript functions á la Python Docstrings

It is valid JavaScript to write something like this: function example(x) { "Here is a short doc what I do."; // code of the function } The string actually does nothing. Is there any reason, ...

热门标签