【问题标题】:How do I display a lightbox on only homepage of my blogger blog?如何仅在我的博主博客的主页上显示灯箱?
【发布时间】:2012-01-16 14:37:37
【问题描述】:

我有这个代码:

<script src='http://ajax.googleapis.com/ajax/libs/jquery/1.5/jquery.min.js'/>

     <script src='https://gj37765.googlecode.com/svn/trunk/html/[www.gj37765.blogspot.com]jquery.colorbox-min.js'/>
 <link href='https://gj37765.googlecode.com/svn/trunk/html/%5Bwww.gj37765.blogspot.com%5Dfbpopup.css' rel='stylesheet' type='text/css'/>
 <script type='text/javascript'>
     jQuery(document).ready(function(){
        if (document.cookie.indexOf(&#39;visited=flase&#39;) == -1) {
            var fifteenDays = 1000*60*60*24*30;
            var expires = new Date((new Date()).valueOf() + fifteenDays);
            document.cookie = &quot;visited=false;expires=&quot; + expires.toUTCString();
        $.colorbox({width:&quot;400px&quot;, inline:true, href:&quot;#mdfb&quot;});
            }
     });
     </script>

该代码用于当用户访问我的博客时出现的类似 Facebook 的框。我的博客在博客上。我的问题是,每当用户看到其他帖子或刷新页面时,这个 jquery 的灯箱就会一次又一次地出现。我希望它只出现在网站的主页上。我对jQuery一无所知。

【问题讨论】:

  • 在这里帮助我们...您需要更具描述性,并提供一些具体信息:例如:当您说“此 jquery 一次又一次出现”时,您的意思是具体代码正在出现,或者您看到多个灯箱?这段代码在哪里?它在您所有页面的模板中吗?如果是这样,这就是它出现在所有页面上的原因,而不仅仅是主页。

标签: javascript jquery html css lightbox


【解决方案1】:

很可能是&amp;quot;。将它们全部更改为"。将&amp;39; 也更改为'

【讨论】:

  • 还有 &amp;#39; 文字 - 将其更改为 '
  • 我试过了,但没用。当我转到下一页时,我可以再次看到灯箱。
  • 您是否将其包含在模板中?
  • 是的。在我的博客模板中。我只希望当用户访问网站主页时该灯箱只出现一次。但它出现在每一页上。
  • 你应该把它发布在你的主页而不是模板上。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-03-16
  • 2019-05-17
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多