Jump to content

Using A Cookie To Keep A Sliders State.


SuperPaperSam
 Share

Recommended Posts

Bellow I have some code that I use to move a table up and down. Then I have a div that hides the overflow so it looks like the table is partially gone. I wan't it to be displayed on every page if the user has already chozen to display it. I also want it to stay in the down state (partially hidden) if the lowered it on the previous page.I was hoping someone could show me a way to do this with a cookie.Ask me to clarify if this makes no since. Thanks.

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Untitled Document</title><script src="jquery-1.2.6.min.js" type="text/javascript"></script><style type="text/css">#chatBoxHider { display:none; overflow: hidden; height: 300px; width: 230px; }#chatBox { width:230px; height:300px; }#chatHeader { height:10px; }#chatBoxContent { color: #333333; }</style><script type="text/javascript"> jQuery.fn.blindToggle = function(speed, easing, callback) {   var h = this.height() + parseInt(this.css('paddingTop')) + parseInt(this.css('paddingBottom'));   return this.animate({marginTop: parseInt(this.css('marginTop')) >0 ? 0 : +270 }, speed, easing, callback);   }; $(document).ready(function() {  var $box = $('#chatBox') $('#blind').click(function() {  $box.blindToggle('slow');  });	 });</script><script language="javascript"> function toggle() { var ele = document.getElementById("chatBoxHider"); var text = document.getElementById("displayChat"); if(ele.style.display == "block") {	  ele.style.display = "none";   } else {  ele.style.display = "block"; }} </script></head><body><a id="displayChat" href="java script:toggle();">Togal</a><div id="chatBoxHider">	<table id="chatBox" cellpadding="0" cellspacing="0">		<tr>			<td id="chatHeader">blaaaaaaaah <a id="blind"> blind </a> blah</td>		</tr>		<tr>			<td id="chatBoxContent">bllllllahhhhhhhhhhhbbbbbbbbllah!</td>		</tr>	</table></div></body></html>

Link to comment
Share on other sites

Yes. It was great. But I have totally redone my site and I have added some pretty cool effects. I did try changing the cookie to make it work with this one but I had no success :) I get confused when I get to the part when I want the sliders state to be the same. I don't know how to tell the difference between it hidden and visible.Are there any tutorials that you could point me to? I have read some but none cover how to use it with a slider.THANKS!

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...