Although the demand for a 1024px (or less) solution for this blog has been next to none, it’s a feature that I’ve kept in mind since the launch of the new layout. So today I’m happy to announce the solution I’ve chosen, the ability to toggle the sidebar. The button is located in the page navigation, floated to the right and I’ve tested the feature in FF 3.5+ (OS X & Windows), Safari 4, Opera 9.64 and IE8.
The feature is built with jQuery and although it took me some time to get it working, it’s a pretty easy script.
<script type="text/javascript">
$(document).ready(function() {
$("#container").width("1200px");
$("#menu").show();
$(".togglemenu").click(function(){
if ($("#menu").is(":visible")) {
$("#menu").hide();
$("#container").animate({width:"900px"});
$(this).addClass("active");
$.cookie('side-menu', 'hiding', {path: "/"});
return false;
} else {
$("#container").animate({width:"1200px"});
$("#menu").delay(300).fadeIn(1000);
$(this).removeClass("active");
$.cookie('side-menu', 'showing', {path: "/"});
return false;
}
});
var sidemenu = $.cookie('side-menu');
if (sidemenu == 'hiding') {
$("#menu").hide();
$("#container").width("900px");
$(".togglemenu").addClass("active");
};
})
;
</script>
Rather than simulating a delay function I’m using this plugin, mainly because it’s easier to understand the code that way (’cause I’m a noob). I’m also using this cookie plugin so you don’t have to click on the toggle button on every refresh^^
Well, I hope you’ll enjoy this, and as always, let me know what you think!
Related posts:

















{ 20 comments… read them below or add one }
Hey, this is pretty slick. I use a netbook as my primary machine, so the ability to toggle a sidebar would be incredibly beneficial. Might just build this into some of my professional and personal sites, too.
That said … need to check to see what some advertiser’s might say about it on the pro sites :P
Thanks!
Might be a bad idea on professional sites where you want ad revenue from sidebar ads. But if you actually have something in the sidebar that readers want to see every once in a while, it should be fine. Although, the value of a sidebar definitely decreases with this kind of feature on the site. But if the site is made for a resolution bigger than 1024px it shouldn’t really matter, as those who use 1024px or less don’t see the ads anyways.
I like this a lot.
I’m keeping your site without the sidebar for now. Nothing against your ads or site design I just prefer the slimmer version and I already visit the ads posted.
Well, I’m glad you’re liking it. I also like it without the sidebar actually! Also good for those at work who don’t want their boss to see Airi in a bikini^^
Kinda hard to not click on the ads on this site, as they’re well targeted.
Haha I agree, I want to click my own ads all the time… xD
It’s funny you should say that. Sometimes I get upset that I can’t click my own ads because every now and then I see something pop up that I really want to visit.
Yeah. I wonder if it helps if you turn on private browsing?
Are you kidding? The Google sees all…
Haha that is true :P Using a proxy should work though! But it’s not like I’m gonna turn on a proxy just to click on an ad… xD
Nice update there sir, I like the possibility to chose, it’s also benefiting when you browse the blog on an iPhone. What’s next? iPhone version maybe? :D
Yeah it is indeed a very nice feature for iPhone users. As for an iPhone version of the site… It’s a good idea but I don’t have any experience whatsoever in making such a thing, something for the future maybe.
seamless and quick. A large amount on my visitors are using lower resolutions and my sidebar is used. Awesome toggling though, I think I prefer the sidebar off too.
Yeah, I have a pretty large number of low res readers as well, so this feature is probably very much appreciated! I might add a third toggle option in the future, possibly an icon based sidebar that fits in 1024px as well.
I was going to mention what Jason mentioned, that being able to permanently hide the sidebar might be a bad thing when it comes to advertisers and their willingness to allow their ads to be hidden. Also, any idea how that affects Adsense? Does it still count as a pageview if the sidebar is hidden? And more than that, if Google noticed it would they slam dunk you back to 0,00?
Of course (and not to hijack the comment thread) I’ve been debating the value of having ads at all. I thought it was a really neat idea to be able to make a little change on the side, just for doing what I was going to be doing anyway, but on a personal blog it doesn’t stack up that fast. It could be 5 years before I see 100 bucks from it and can claim a check. Ha ha ha!
I believe that it still counts as a pageview as you still load the sidebar, but I’m not sure, and I don’t have Adsense in the sidebar anyways. And of course Google wouldn’t be against that, you’re free to place your ads anywhere on your site after all.
Out of my own experience, Adsense hasn’t worked really well, and I don’t think it works unless you have a pretty large number of visitors. Affiliate ads on the other hand works pretty well!
Ya, I think that would work well, but I suppose you have to have a proven level of audience before people go for that. I suppose it all depends on what you write about. I could write a blog that would pull more visitors than what my personal blog does, but I just don’t want to. That would make it feel like a job instead of a hobby. That’s just my take anyway. I suppose if I really got back into anime I could write about that, or when I get back to the US and start collecting firearms and hunting, I could blog about that. O_o People like those things. Guns, anime, and maybe some boobs for good measure? J/k. ^_^
I could also start a new blog in another niche and get a larger audience. I’d happily blog for a living, but to reach such a level takes a lot of effort and time, and it’s very hard if you have a daytime job as well. So at least for now I’ll let it be just a hobby^^
So very true. It would take a lot of work. I think I’d rather just leave it as a hobby as well.
Yeah, at least my hobby pays for itself. The ad and affiliate revenue pays for my hosting, domains and stuff like that!