I have a jQuery contact form that has the first page visible (using css) upon entering my website. After a user completes the form, I would like them to be able to visit other pages of the site without the form reopening upon page load. Does anyone have a good way to do this? It would be great if it would be visible again after they actually close / leave the website. Thank you!
HTML
<!DOCTYPE html>
<head>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script src="js/isleymultiform.js"></script>
<link rel="stylesheet" href="css/isleymultiform.css" type="text/css" />
</head>
<body>
<div id="request"><p class="button">REQUEST INFO</p></div>
<div id="form_container">
<div id="page_1">
<p class="form">
<label>Email Address: </label><br /><input value="Email Address"></input>
<br /><br />
<label>Your Desired Degree: </label><br /><select id="select_length"><option>Science</option><option>Math</option><option>Yoga</option></select>
<br /><br />
<input type="button" id="to_page_2" value="Next"/>
</p>
</div>
<div id="page_2">
<p class="form">
<label>First Name: </label><br /><input value="First Name"></input>
<br /><br />
<label>Last Name: </label><br /><input value="Last Name"></input>
<br /><br />
<label>Phone Number: </label><br /><input value="Phone Number"></input>
<br /><br />
<label>Preferred Location: </label><br /><select id="select_length"><option>Minneapolis, MN</option></select>
<br /><br />
<label>High School Graduation: </label><br /><select><option>2001</option><option>2002</option><option>2003</option></select>
<br /><br />
<br /><br />
<input type="button" id="to_prev" value="Previous"></input>
<button id="to_close">Submit</button>
</p>
</div>
</div>
</div>
</body>
</html>
JAVASCRIPT
$(document).ready(function(){
$("#request").click(function(){
$("#page_1").animate({"height": "220px"},
"slow");
$("#page_1").show("slow");
$("#form_container").toggle("6000");
});
$("#to_page_2").click(function(){
$("#page_2").show();
$("#page_2").animate({"height": "400px"},
"slow");
});
$("#to_close").click(function(){
$("#page_2").hide("fast");
$("#page_1").animate({"height": "0px"},
"fast");
$("#page_2").animate({"height": "0px"},
"fast");
$("#form_container").hide("fast");
});
$("#to_prev").click(function(){
$("#page_2").hide("slow");
$("#page_2").animate({"height": "0px"},
"slow");
});
});
CSS
#isley_globeform {
display: block;
position: absolute;
right: 0;
top:40px;
z-index: 9990;
}
#form_container {
display: block;
}
#page_1 {
position: absolute;
background-color: #7cac24;
width: 180px;
height: 220px;
display: block;
border-bottom-left-radius: 10px 10px;
border-bottom-right-radius: 10px 10px;
border-top-right-radius: 10px 10px;
}
#page_2 {
position: absolute;
background-color: #7cac24;
width: 200px;
height: 0px;
display: none;
border-bottom-left-radius: 10px 10px;
border-bottom-right-radius: 10px 10px;
border-top-right-radius: 10px 10px;
}
#request {
display: block;
position: relative;
font-size: 16px;
font-weight: bolder;
background-color: #7cac24;
width: 145px;
height: 40px;
z-index: 9998;
}
p.form {
font-size: .9em;
font-weight: bold;
color: #FFF;
margin-left: 10px;
}
p.button {
padding: 8px 13px;
font-size: 1em;
font-weight: bold;
color: #FFF;
cursor: pointer;
}
#to_page_2 {
position: relative;
;
background-color: #FFF;
right: -58px;
}
#to_close {
position: relative;
;
background-color: #FFF;
right: -26px;
}
#to_prev {
position: relative;
;
background-color: #FFF;
right: -10px;
}
.select_length {
width: 155px;
}
THANK YOU!!!