Jump to content

Using A Cookie To Keep A Sliders State.

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 post
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 post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

  • Create New...