Log in

View Full Version : Close div layer



Lucifix
06-26-2008, 09:11 PM
I'm looking for scripts that would close div layer on click (icon) and set cookie, so the next time user visit the page, div layer will be invisible (maybe similar as on cnn page - Set your CNN edition).

Thank you.

jscheuer1
06-27-2008, 12:04 AM
There are tons of scripts that do that general sort of thing. Use Google to find them. Here on DD (perhaps just a partial listing):

http://www.dynamicdrive.com/dynamicindex17/animatedcollapse.htm

http://www.dynamicdrive.com/dynamicindex17/switchcontent.htm

http://www.dynamicdrive.com/dynamicindex17/switchcontent2.htm

http://www.dynamicdrive.com/dynamicindex17/ddaccordion.htm

josephhamilton1
06-27-2008, 03:36 AM
To hide a div just do this:

document.getElementById("myDiv").style.display = "none";

To set a cookie do this:

document.cookie = "myDiv=True;
expires=15/02/2003 00:00:00";

To get the cookie do this:
var x = document.cookie;
var hideDiv = x.split(";")(0);
if(hideDiv == "True")
document.getElementById("myDiv").style.display = "none";
else
document.getElementById("myDiv").style.display = "block";




Download, install, and learn to use Firebug