我正在努力解决一些问题。当我们添加一些内容时,我正在做一个webapp设计和一个客户端,一个弹出窗口(如IOS一个)出现在图标上(设计基于带衬里的图标),显示剩下多少更新。
好吧,主要问题现在变成了:我正在使用cookie.js在主屏幕上设置更新图标,并且我更改了代码,使其仅在您单击图像内部后才会消失。它工作正常,但其他页面中的问题(我的意思是当你点击其他图标)仍然出现更新弹出窗口。
如何在其他页面上隐藏更新弹出窗口?因为在您点击主图标(删除弹出窗口的图标)之前它仍然会看到。
Js代码
<script type="text/javascript">
var popupStatus = 0;
//loading popup with jQuery magic!
function loadPopup(){
//loads popup only if it is disabled
if(popupStatus==0){
$("#backgroundPopup").css({
"opacity": "0.7"
});
$("#backgroundPopup").fadeIn("slow");
$("#popupContact").fadeIn("slow");
popupStatus = 1;
}
}
//disabling popup with jQuery magic!
function disablePopup(){
//disables popup only if it is enabled
if(popupStatus==1){
$("#backgroundPopup").fadeOut(0.0000000000001);
$("#popupContact").fadeOut(0.0000000000001);
popupStatus = 0;
}
}
//centering popup
function centerPopup(){
//request data for centering
var windowWidth = document.documentElement.clientWidth;
var windowHeight = document.documentElement.clientHeight;
var windowscrolltop = document.documentElement.scrollTop;
var windowscrollleft = document.documentElement.scrollLeft;
var popupHeight = $("#popupContact").height();
var popupWidth = $("#popupContact").width();
var toppos = windowHeight/2-popupHeight/2+windowscrolltop;
var leftpos = windowWidth/2-popupWidth/2+windowscrollleft;
//centering
$("#popupContact").css({
});
//only need force for IE6
$("#backgroundPopup").css({
"height": windowHeight
});
$("#popupContact").click(function () {
$("div").hide(0.000000000001);
});
}
//CONTROLLING EVENTS IN jQuery
$(document).ready(function(){
if ($.cookie("anewsletter") != 1) {
//load popup
setTimeout("loadPopup()",0.001);
}
//CLOSING POPUP
//Click the x event!
$("#popupContactClose").click(function(){
disablePopup();
$.cookie("anewsletter", "1", { expires: 7 });
});
//Click out event!
$("#pop").click(function(){
disablePopup();
$.cookie("anewsletter", "1", { expires: 7 });
});
//Press Escape event!
$(document).keypress(function(e){
if(e.keyCode==27 && popupStatus==1){
disablePopup();
$.cookie("anewsletter", "1", { expires: 7 });
}
});
});
</script>
HTML
<div class="imatge">
<div class="imatges" id="hide"><a href="promos.html"><img src="Promociones.png" alt="Promociones" border="0"></a></div>
<div class="imatges"><a href="novedades.html"><img src="Novedades.png" alt="Novedades" border="0"></a></div>
<div class="imatges" id="pop">
<a href="actualizacion.html"><img src="actprod.png" alt="Actproducto" border="0"></a>
<div id="popupContact"></div>
</div>
<div class="imatges"><a href="http://anubis-cosmetics.com/news/indexapp.html"><img src="newsletter.png" alt="Newsletter" border="0"></a></div>
<div class="imatges"><a href="http://www.blog.anubis-cosmetics.com"><img src="Blog.png" alt="Blog" border="0"></a></div>
<div class="imatges"><a href="agenda.html"><img src="Agenda.png" alt="Agenda" border="0"></a></div>
<div class="imatges"><a href="sugerencias.html"><img src="sugerencias.png" alt="Sugerencias" border="0"></a></div>
<div class="imatges"><a href="contacto.html"><img src="Contacto.png" alt="Contacto" border="0"></a></div>
<div class="imatges"><a href="socialmedia.html"><img src="socialmedia.png" alt="socialmedia" border="0"></a></div>
</div>
我甚至试图用Jquery
将其隐藏在其他页面中<script>
$(".imatges").hide();
$("#popupContact").click(function ( event ) {
event.preventDefault();
$(this).hide();
});
</script>
但没有用......
感谢您的帮助,谢谢