Something like so:
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title></title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.3/jquery.min.js" type="text/javascript"></script>
<script type="text/javascript">
document.write('<style type="text/css">.slideHide {visibility: hidden;}<\/style>');
jQuery(function($){
var s = $('#slide'), w = $(s.find('span')[0]).width(), cookie = {
set: function(n, v, d){ // cookie.set takes (name, value, optional_persist_days) - defaults to session if no days specified
if(d){var dt = new Date();
dt.setDate(dt.getDate() + d);
d = '; expires=' + dt.toGMTString();}
document.cookie = n + '=' + escape(v) + (d || '') + '; path=/';
},
get: function(n){ // cookie.get takes (name)
var c = document.cookie.match('(^|;)\x20*' + n + '=([^;]*)');
return c? unescape(c[2]) : null;
},
kill: function(n){ // cookie.kill takes (name)
cookie.set(n, '', -1);
}
};
s.css({width: w, overflow: 'hidden', whiteSpace: 'nowrap'});
$('#slideContainer').css({minWidth: w, height: s.height()});
$('#clicky').toggle(function(){
s.stop(true).animate({width: 0}, {duration: 'slow', queue: false, complete: function(){s.hide();}});
cookie.set('slider', 'in');
}, function(){
s.stop().animate({width: w}, {duration: 'slow', queue: false});
cookie.kill('slider');
});
if(cookie.get('slider') === 'in'){
s.css({width: 0, display: 'none'});
$('#clicky').click();
}
s.removeClass('slideHide');
});
</script>
</head>
<body>
<input name="" type="button" value="Click me" id="clicky">
<div id="slideContainer">
<div id="slide" class="slideHide">
<h1><span>Hello World!</span></h1>
</div>
</div>
</body>
</html>
Bookmarks