views:

384

answers:

2

I need an div (for advertisement) that slides down like here (when loading the page): http://www.webintenta.com/Files/JQueryCollapse.html

Tricky part: When I click on the [x] the whole div should disappear. I want it to disappear for the Browser Session or better for the IP that accessed it. Saving it to a Cookie would also be a solution.

How can I do that? Thanks

A: 

simply write a cookie - see http://www.quirksmode.org/js/cookies.html or google for more informaion. if the cookie is not set you do the sliding + set the cookie - when its set you ignore it.

in a cookie you can put in a lifetime, so it stays for multiple sessions. as long as the user comes with the same browser it should work.

When you want to do soemthing with the ip, you have to use a server side technique - which i dont recommend in this use case.

Niko
+1  A: 

As you say, you can save it using a cookie. There is an abundance of JQuery cookie handlers out there, e.g. this.

Deniz Dogan

related questions