0

I'm trying to get a div with a close option to work, but some how it doesn't work correctly..

First of all I found this thread:

http://stackoverflow.com/questions/10674611/hide-div-24hr-cookie-javascript

And here is the working JSFiddle example I want to achieve:

http://jsfiddle.net/FcFW2/1/

I want to understand where the "display: block" on the div comes from? I can't find it in the script?.. The css for #popupDiv has the value display: none.

I copied/pasted the script/css/html to my site:

http://lampen.identitest.dk/

At the bottom of my site you will find it.. the problem is that it is loaded with display: none ("display: block" is not added to the div).

I hope you can help me out and try to explain it for me.

Best Regards Shane M

1 Answers1

0

the "display:block" comes form the jquery show() method

$(document).ready(function() {

  // If the 'hide cookie is not set we show the message
  if (!readCookie('hide')) {
    $('#popupDiv').show();
  }

here initially it is set to dispaly:none from css and when the page loads it checks if the cookie is present, if not then it calls the show method will will add "display:block" to the #popupdiv

Nithin
  • 5,470
  • 37
  • 44
  • Hi user3701807, then I guess the cookie is presented since it doesn't call the show method? I tried to create a simple html document http://clions.dk/test.html and here it works. Is is something to do with wordpress? I cannot find the issus and it is first time I try to use cookies :( – Shane Akira Oct 24 '14 at 14:12