Revision: 9563
Updated Code
at November 12, 2008 11:14 by conspirator
Updated Code
<script src="graphics/js/jquery-1.2.6.min.js" type="text/javascript"></script> <script src="graphics/js/jquery.cookie.js" type="text/javascript"></script> <script type="text/javascript" charset="utf-8"> $(document).ready(function() { // See which font size the user wants $(".text a").click(function() { switch ($(this).attr("class")) { case 'small' : setFontSize(.8); break; case 'large' : setFontSize(1.6); break; case 'default' : setFontSize(1.2); break; } return false; }); // Set the font size and set a cookie function setFontSize(size) { $("#wrap, input, textarea").animate({fontSize: size+"em"}, 500).fadeIn("slow"); createCookie(size); } // Create and read coookies // Code functions by: Peter-Paul Koch // http://www.quirksmode.org/js/cookies.html function createCookie(value) { var date = new Date(); date.setTime(date.getTime()+(30*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); document.cookie = "font_size="+value+expires+"; path=/"; } var font_size = $.cookie('font_size'); if (font_size == '0.8') { $('#wrap').css("font-size",".8em"); } if (font_size == '1.6') { $('#wrap').css("font-size","1.6em"); } if (font_size == '1.2') { $('#wrap').css("font-size","1.2em"); } }); </script>
Revision: 9562
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at November 12, 2008 11:10 by conspirator
Initial Code
<script src="graphics/js/jquery-1.2.6.min.js" type="text/javascript"></script> <script src="graphics/js/jquery.cookie.js" type="text/javascript"></script> <script type="text/javascript" charset="utf-8"> $(document).ready(function() { // See which font size the user wants $(".text a").click(function() { switch ($(this).attr("class")) { case 'small' : setFontSize(.8); break; case 'large' : setFontSize(1.6); break; case 'default' : setFontSize(1.2); break; } return false; }); // Set the font size and set a cookie function setFontSize(size) { $("#wrap, input, textarea").animate({fontSize: size+"em"}, 500).fadeIn("slow"); createCookie(size); } // Create and read coookies // Code functions by: Peter-Paul Koch // http://www.quirksmode.org/js/cookies.html function createCookie(value) { var date = new Date(); date.setTime(date.getTime()+(30*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); document.cookie = "font_size="+value+expires+"; path=/"; } var font_size = $.cookie('font_size'); if (font_size == '0.8') { $('#wrap').css("font-size",".8em"); } if (font_size == '1.6') { $('#wrap').css("font-size","1.6em"); } if (font_size == '1.2') { $('#wrap').css("font-size","1.2em"); } }); </script>
Initial URL
Initial Description
You'll need the latest version of [jQuery](http://www.jquery.com) and the jquery.cookie plugin([Snag it here!](http://www.stilbuero.de/2006/09/17/cookie-plugin-for-jquery/))
Initial Title
Smart Text Re-sizer ala jQuery (and cookies)
Initial Tags
textmate, jquery, text
Initial Language
Other