Note that there are some explanatory texts on larger screens.

plurals
  1. POTrying to show updates with a cookie.js
    primarykey
    data
    text
    <p>I need some help for something I am working on it. I'm doing a webapp design and a client whants when we add some content, a popup (like IOS one) appear on the icon (the design is based on lined icons) showing how many updates are left.</p> <p>Well, the main problem becomes now: I'm using cookie.js to set the update icon on the homescreen and I changed the code to make it dissappear only once you clicked inside the image. It works fine, but the problem there's that in the other pages (i mean when you click on the other icons) still appearing that update popup. </p> <p>How could I hide that update popup on the other pages? Because it still seeing until you click on the main icon (the one who deletes the popup).</p> <p>The Js Code </p> <pre><code>&lt;script type="text/javascript"&gt; 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 &amp;&amp; popupStatus==1){ disablePopup(); $.cookie("anewsletter", "1", { expires: 7 }); } }); }); &lt;/script&gt; </code></pre> <p>The HTML </p> <pre><code> &lt;div class="imatge"&gt; &lt;div class="imatges" id="hide"&gt;&lt;a href="promos.html"&gt;&lt;img src="Promociones.png" alt="Promociones" border="0"&gt;&lt;/a&gt;&lt;/div&gt; &lt;div class="imatges"&gt;&lt;a href="novedades.html"&gt;&lt;img src="Novedades.png" alt="Novedades" border="0"&gt;&lt;/a&gt;&lt;/div&gt; &lt;div class="imatges" id="pop"&gt; &lt;a href="actualizacion.html"&gt;&lt;img src="actprod.png" alt="Actproducto" border="0"&gt;&lt;/a&gt; &lt;div id="popupContact"&gt;&lt;/div&gt; &lt;/div&gt; &lt;div class="imatges"&gt;&lt;a href="http://anubis-cosmetics.com/news/indexapp.html"&gt;&lt;img src="newsletter.png" alt="Newsletter" border="0"&gt;&lt;/a&gt;&lt;/div&gt; &lt;div class="imatges"&gt;&lt;a href="http://www.blog.anubis-cosmetics.com"&gt;&lt;img src="Blog.png" alt="Blog" border="0"&gt;&lt;/a&gt;&lt;/div&gt; &lt;div class="imatges"&gt;&lt;a href="agenda.html"&gt;&lt;img src="Agenda.png" alt="Agenda" border="0"&gt;&lt;/a&gt;&lt;/div&gt; &lt;div class="imatges"&gt;&lt;a href="sugerencias.html"&gt;&lt;img src="sugerencias.png" alt="Sugerencias" border="0"&gt;&lt;/a&gt;&lt;/div&gt; &lt;div class="imatges"&gt;&lt;a href="contacto.html"&gt;&lt;img src="Contacto.png" alt="Contacto" border="0"&gt;&lt;/a&gt;&lt;/div&gt; &lt;div class="imatges"&gt;&lt;a href="socialmedia.html"&gt;&lt;img src="socialmedia.png" alt="socialmedia" border="0"&gt;&lt;/a&gt;&lt;/div&gt; &lt;/div&gt; </code></pre> <p></p> <p>I even tried to hide it in the other pages with Jquery </p> <pre><code>&lt;script&gt; $(".imatges").hide(); $("#popupContact").click(function ( event ) { event.preventDefault(); $(this).hide(); }); &lt;/script&gt; </code></pre> <p>but didn't work...</p> <p>I appreciate your help, thank you</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload