【发布时间】: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('visited=flase') == -1) {
var fifteenDays = 1000*60*60*24*30;
var expires = new Date((new Date()).valueOf() + fifteenDays);
document.cookie = "visited=false;expires=" + expires.toUTCString();
$.colorbox({width:"400px", inline:true, href:"#mdfb"});
}
});
</script>
该代码用于当用户访问我的博客时出现的类似 Facebook 的框。我的博客在博客上。我的问题是,每当用户看到其他帖子或刷新页面时,这个 jquery 的灯箱就会一次又一次地出现。我希望它只出现在网站的主页上。我对jQuery一无所知。
【问题讨论】:
-
在这里帮助我们...您需要更具描述性,并提供一些具体信息:例如:当您说“此 jquery 一次又一次出现”时,您的意思是具体代码正在出现,或者您看到多个灯箱?这段代码在哪里?它在您所有页面的模板中吗?如果是这样,这就是它出现在所有页面上的原因,而不仅仅是主页。
标签: javascript jquery html css lightbox