Hey guys. Today I’m going to teach you how to create a useful hover-based user interface using jQuery, CSS3, HTML5 and @font-face. Why a hover-based interface? you might ask. Well, with the popularity of touch-based web applications simplifying the way that people can use sites on mobile devices, I think that there’s room for us to look into ways of making it even easier for people to use sites in desktop-based browsers too. Today’s project,WanderWall, achieves that and what we’ll be creating today could easily be used for a portfolio or business site but the concepts you’ll learn could certainly be used to expand the idea further.
If you’d like to check out a demo before we get started, feel free to check out one of three available below.
you can also watch a screencast about WanderWall here.

What is a Hover-Based Interface?
A hover-based interface is one where the majority (or all) of the user interaction on the page can be controlled by a user hovering over an element with their cursor. Hover-based interfaces require less work to see more content than a typical click based page, but do need some thought to be put into their design and structure so that the user knows how to navigate around. WanderWall uses a hover-based interface. Some might ask, well, mobile device’s don’t necessarily support the hover-over state, so should we really consider using them?.
I think the answer to this is definitely a firm yes. If you look at a number of the most popular site’s out there, they actually have two versions of their site available – one used for desktop browsers (full layout) and another which is optimized for mobile (touch focused). I think that hover UIs are certainly something we could consider for the former, but we of course would evaluate suitability on a site by site basis. I’m not saying that every site out there should adopt the concept, but there are cases where it would make navigation a quicker experience for users.
Why Is WanderWall useful?
That’s a very good question. I’m going to use a portfolio site as an example here as they tend to contain fewer pages. Even on a standard portfolio site, users typically have to click through a few different links to browse through the site (or ‘page’ if it’s a one-page portfolio with anchor text). This only gets compounded as the sites you’re looking at grow larger. There’s nothing wrong with clicking par-se (it’s successfully worked as an action for years), but consider that users in general are lazy (I include myself in this group) – anything you can do to decrease the amount of work they have to do to look around your site will mean that they’re able to view your content more quickly.
What does this mean for you? Well if it’s a portfolio site, it may just mean more requests for work if you’ve been able to get the visitor’s interest before they got bored of clicking. Obviously this all depends on the quality of content etc as well, but if your average visitor spends less than 2 minutes on your page, who is going to have to work ‘less’ to see your material – the person that clicks or the person that hovers?.

How Does WanderWall work?

WanderWall is composed of two key components that interact with each other. Before we get started I should mention that for my demos I have included a background-image containing multiple parts to it (a pseudo-sprite) used in the header. We shall refer to this as the header-wallpaper. The components (without mentioning styling) are as follows:
1. Header-Slider: When a user hovers over one of the ‘frames’ (links) in the header, this animates down to a position in the header-wallpaper with a unique background specific to that particular link. Once the header-wallpaper has been rendered, text specific to that section then fades in – essentially a subtitle or tagline for that page.
2. Page-Slider: At the same time that the user has hovered over a link in the header-slider, a corresponding ‘page’ element slides into view (this is basically a div container which may contain text, images, video – any HTML content at all).
When a user hovers away from a particular link, the last page that they were looking at remains in view. The reason for this is that if there is further content on the page you may wish them to be able to hover-over on, scroll-down or click, they are able to do so.
How does WanderWall make use of CSS3, @font-face and HTML5?
CSS3 is used for the styling and design in WanderWall and assists with text-indentation, background-gradients and rotation. With the exception of my optional background-image, this allows the project to be relatively compact without sacrificing on design and asthetics. @font-face is used for the majority of typography and has been implemented in a cross-browser fashion with the assistance of Font-Squirrel’s excellent generator.

I personally found font-face to be significantly faster than Cufon or sIFR in terms of the time taken to visibly-render, which makes sense as there is no JavaScript required to power it after page-load. HTML5 is used to power the data-tooltips that you find on the right-hand side of the screen. These leverage the "data-" attribute in HTML5.
For CSS purists, yes, you can of course achieve a similar effect without the need for the data-attribute here, but as I wished to include a sample of it’s potential usage, it’s been included in WanderWall as an optional feature. You can easily switch over to using jQuery based tooltips quite easily if you prefer.
Let’s Create a WanderWall
The first thing to do when creating a Hover-based interface is plan out how your interaction is going to work. I probably went through 12 different iterations planning this project before I was happy and it’s important to try thinking from a user’s perspective before you dive into the coding. Once that’s done, you’ll first want to write some HTML to define your page’s structure.
HTML for the header frames (links)
HTML for the sliding pages
jQuery
Wanderwall 1
jQuery
Wanderwall 2
jQuery
Wanderwall 3
jQuery
Wanderwall 4
In real life, you’ll probably define some very simple CSS to structure your design next, but to keep things simple, I’m first going to show you the important parts of the JavaScript in this project and then the final CSS3. (I recommend waiting until you’ve finishing the JavaScript side of things before ‘touching up’ the design, but you do whatever feels most comfortable.)
jQuery For Background Animation (on frame hover)
$("div.frame a").hover(function()
{
var currentLink = $(this);
hideTheRest(id); id = this.id.replace("link", "");
position = -295*id;
marginnew = pagewidth * id * -1;
/*Display the Home link if not currently on Default Page*/
if(id > 0)
{
$('#homelink').show();
}else{
$('#homelink').hide();
}
/*Move the page-slider in the correct direction depending on the ID*/
$('.pageslider').stop().animate({marginLeft: marginnew}, 800);
/*Animate the background*/
$('#wanderwall').stop().animate({backgroundPosition:
'(50% ' + position +'px )'}, 500, function()
{
distance = 0;
topdis = -190;
text = currentLink.attr('alt');
infoframe = $('#infoframe');
/* Define offset for text*/
switch(id)
{
case "1":
distance = 500;
break;
case "2":
distance = 730;
break;
case "3":
distance = 200;
break;
case "4":
distance = 400;
topdis = -198;
break;
}
infoframe.html(text);
infoframe.css('margin-left', distance + 'px');
infoframe.css('margin-top', topdis + 'px');
infoframe.fadeIn();
});
}, function()
{
$('#infoframe').hide();
var id = this.id.replace("link", "");
$('#wanderwall').stop().animate({backgroundPosition: '(50% 0px)'}, 500 );
showTheRest();
});
jQuery For Showing And Hiding Other Elements On Hover Of One
function hideTheRest(id){
for (var i=1; i<5; i++){
if (i!=id)
{
$('#frame' + i + ' a').css('display', 'block');
/*Set the alpha transparency*/
$('#frame' + i).css('filter', 'alpha(opacity=80)');
/*Fast-fade animation*/
$('#frame' + i).stop().fadeTo("fast",0);
/*Don-t display the link*/
$('#frame' + i + ' a').css('display', 'none');
}
}
$('#infoframe').css('visibility','visible');
}
function showTheRest(){
for (var i=1; i<5; i++){
$('#frame' + i).stop().fadeTo("fast",0.8);
$('#frame' + i).css('filter', 'alpha(opacity=80)');
$('#frame' + i + ' a').css('display', 'inline');
$('#frame' + i + ' a').css('display', 'block');
}
$('#infoframe').css('visibility','hidden');
}
These are some extracts of the most important jQuery code used to power WanderWall. If you would like to take a deeper look into the code, I recommend checking out the source which can be downloaded at the beginning or end of this post. Let’s now take a look at some of the important CSS3.
CSS3 for the background gradient and 3D ‘mantle’ bar

body{
background:
-webkit-gradient(
linear,
left bottom,
left top,
color-stop(0.09, rgb(153,153,153)),
color-stop(0.55, rgb(242,242,242)),
color-stop(0.78, rgb(240,237,240))
);
background:
-moz-linear-gradient(
center bottom,
rgb(153,153,153) 9%,
rgb(242,242,242) 55%,
rgb(240,237,240) 78%
);
}
#mantle { width:100%; height:30px; background:
-webkit-gradient(
linear,
left bottom,
left top,
color-stop(0.09, rgb(153,153,153)),
color-stop(0.55, rgb(242,242,242)),
color-stop(0.78, rgb(252,252,252))
);
background:
-moz-linear-gradient(
center bottom,
rgb(153,153,153) 9%,
rgb(242,242,242) 55%,
rgb(252,252,252) 78%
);
-webkit-background-origin: padding;
-webkit-background-clip: content;
border-bottom:1px solid #fff;
}
CSS3 for Frame Rotation

.frame:hover{
-webkit-transform: rotate(-9deg);
-moz-transform: rotate(-9deg);
}
Cross-Browser @font-face
@font-face {
font-family: 'LeagueGothicRegular';
src: url('league_gothic-webfont.eot');
src: local(''),
url('league_gothic-webfont.woff') format('woff'),
url('league_gothic-webfont.ttf') format('truetype'),
url('league_gothic-webfont.svg#webfontwJ2IAlek') format('svg');
font-weight: normal;
font-style: normal;
}
CSS3 @font-face consumption and text-shadow (indentation effect) Sample

color:#444444; letter-spacing:-1px; text-shadow:0 1px 0 #FFFFFF; font-family: 'LeagueGothicRegular', sans-serif; font-size-adjust: 0.55; font-size:40px; margin-top:30px;
and that’s it!. You can very easily customize WanderWall for your own projects and remember that you’re not just limited to using 4 links/frames on the top. You can modify the code to have as many as you’d like and to look however you’d like too (in case for example you’d rather use buttons for the links instead of frames).

Got a question? Check the FAQ real below real quick and if it’s not answered there, feel free to leave a comment below and I’ll do my best to help. Scroll down to the end of the post to get your download pack now.
Frequently Asked Questions
-Does WanderWall work in all browsers?
I’ve attempted to make this project as cross-browser compatible as possible. It’s been tested on Safari, Chrome and FireFox for the Mac and Windows as well as IE6. If however you notice a quirk, let me know and I’ll try my best to get it fixed for the next release. Please note that due to the resolution of the one image I do use in this project, it may take a few moments to appear depending on your connection speed. That said, it loads in under a second on mine so you might not notice and delay.
-How do you create the background-image used in the header-wallpaper?
With the increase in both screen sizes and screen resolution we’ve noticed over the past few years, the background to the header needs to be able to cater for screens of any size (within reason). To start, you first need to create an image that’s approximately 3000×1445 or over. I recommend taking a look at the theme examples in my images folder (test_3, test_5 etc) as this will give you an idea of where each ‘wallpaper’ needs to end. If you prefer to keep your file-sizes down, you can always either opt to disable the animated background or use a simple-palette GIF file instead.
Demos and Sources
I’ve created three demos that you can checkout below. Each has the same base content, but offers an alternative header-theme so you can see a few different ways that you can use the background-animation. The download pack contains all of these.
Did you enjoy this article?. If so please feel free to share it with your friends or colleages by clicking the retweet button. Thanks and I hope the post came in useful!.


Волшебно.
Ви благодариме
(Google helped me translate
This is pretty cool. Well done, my friend.
I hope we can expect more nice tutorials from you
Thanks Michael!
Bastante bueno y útil!
Use Google Translate again
haha. Muchas Gracias
(Google translate saves the day again!)
NICE!!!!!
Thanks!
I can easily break it by hovering any of the images and then quickly moving the mouse to any of the other three. Or just moving the mouse outside of the picture and back in before the animation finishes.
(Tested in latest Chromium 7 nightly)
Hmm. When you say break, what's happening when you do the above action? (eg. is a particular element moving out of place, is the animation ceasing to stop? etc)
Eu acho que o Google Translate vai salvar a sua vida novamente
Congratulations, man! Great work! (look ma, without GT =)
very nice work thank you sir!
Thanks a lot Daniel!
IF i want to add more frames,as im doing an animation i would like to use this interface,
can you help me out.
Wooooow!
OMG this post is really good dude!
I'll be waiting 4 mo tutos from u!
Congrats!
Addy Osmani – you are a Genius ! and you will never cease to amaze me ! why….you whip up more magic than Houdini !
Simply UBER-AWESOME !!!
M.
haha!. I'm not a genius at all. I just like creating things
Thanks a lot for your kind compliments, though. I'm glad you liked the post!
i like that dude. thanks
You're very welcome.
Very very cool
I\’m real glad you liked it Jasper.
wow stunning plugin addy really awesome…
Thanks
test
Very nice post, knowledgeable as well appreciative.
Thanks Anil.
Spectacular Work !!
I hope it comes in useful!
Nice overview of those techniques.
1 quirk. The CSS3 and HTML5 texts don't display properly on the header.
I use Firefox 3.6.7 on a netbook with 1024×600 running Fedora Linux.
Thanks for informing me of the quirk. I'll do a little more testing on FF for Linux and see if I can patch up the issue.
very cool. I'd like to try that out.
Let me know how it goes!.
Very nice! I have some suggestions to improve it, like add an -*-transform-origin: 110px 5px (the nail position into the .frame) to make the rotation more real, and make use of -o-transform properties, that works with the latest stable Opera browsers. Also, add some failsafe background colors to browsers that doens`t support CSS gradients will be great too.
I appreciate the suggestions Danillo!. Will definitely consider them for the next update.
Really really nice.
It just "scatters" a little bit on firefox when mouse is hover a menu button…
Great effort, though as we move towards touch interfaces, I'm not sure that any hover-based interface will remain useful as a cross-device pattern.
I think it's going to be really interesting seeing how interfaces evolve over the next 1-2 years. For example, just how easily will people find switching to touch based desktops? I can still see some people being a little too used to a 2/3 button mouse (which is one area where hover-based UIs may find their place) but in the mean time, we can experiment with some potentially viable alternatives
Yeah, it will be an interesting transition. The trend looks like touch though, and we can see that touch = the death of hover (and by extension, Flash). Anyway, good work, brother!
Pingback: مختارات من تويتر #12
Pingback: Ultimate jQuery, HTML5 and CSS3 Tutorial Roundup | Freshen Up Design
Excellent work!
Thanks Adrian!
LIke it, though would be cool if you were using CSS transitions when avaliable rather than jQuery animation…
Hey Rich!.
I really wanted to stick to using CSS animation, but to help ensure that this release was also backwards compatible with older versions of IE, I had to give transitions a pass this time. No worries, though, I will indeed be releasing some new projects that do feature CSS transitions in the near future
- Addy
Pingback: Useful Hover-based User Interface with jQuery, CSS3, HTML5 | Webplus - web developer resource blog
Pingback: Useful Hover-based User Interface with jQuery, CSS3, HTML5 | Appwebmaster
Pingback: A jQuery, CSS3 and HTML 5 Useful Hover-Based Interface | Made Favorite
Pingback: Useful Hover-based User Interface with jQuery, CSS3, HTML5 | CSS Hunt
Major problem! I personally have 1680 width viewport, but when I view Wanderwall in the widths of some commons 1024 and 1280.. there is a scroll bar at the bottom that scrolls to all black AND the text for the "home" slide is completely of screen in viewport width of 1024, and cut in half at 1280!
WanderWall was created with widescreens in mind (most modern ones have resolutions of over 1024 width-wise) but if you play around with the CSS you should be able to adjust it to meet your own needs in about 20-30 minutes. Hope that helps!
Pingback: Weekly Design News – Resources, Tutorials and Freebies (N.53) « UKWDS!
Your a really brilliant person, and thank you for sharing!
Why thank you! and you\’re welcome.
Pingback: WanderWall usando jQuery, CSS3, HTML5 y @font-face | Diseño paginas web
Pingback: Сижу, думу думаю… – Херсонский бомжара
hi there,
Thanks for this latest web design blog. Website should contains quality stuff and many things we have to consider while building it andGood information blog for jquery ,html5.,css3 hover interface related and share advice about site http://hexainfosoft.in” target=”_blank”>:http://hexainfosoft.in
No problem at all!
Hey Just wanted to thank you but I also have a question if I may. The source link does not work. Is there any way to fix that? I am very interested in using this in my website. Please. Thanks again. Diana Magers.
Hi!
I'd like to add more text in the mantletext. how can I do it?
and I'd also like that the href="#" alt= xxxxxxx … because the first 2 frame description's text go over the frame…
thank you!
Excellent work…
Thank you
Pingback: amazing jquery navigation menu tutorials | ExtraTuts
WOW! THANK you
Pingback: 10 mooie menus met jQuery
this design is a world class – keep up with good work
Supercool!!
The remarkable decision showing to possibility of this trio – jQuery, CSS3, html5.
Nice work and looks fabulous. Have you considered doing some modifications for this to suite touch screens, iPad's and other tablets? Hover would not be the best event to make this same magic happen on these gizmos.
This is wonderful but the "How Does This Work," "Compatibility," and "Languages" do not show up at all in IE8. Any ideas how to fix?
Pingback: wordpressで横スライドについての覚え書き | TSHUSUKE.COM
I want to confirm the issue that was posted by Delphi.
It seems like half the functions are not working in IE 8
Looks amazing in firefox.
Any solutions for this?
Pingback: WanderWall jQuery Plugin | jQuery Wisdom
Pingback: Top 100 Useful And Detailed CSS3 Tutorials And Techniques « qeqnes | Designing. jQuery, Ajax, PHP, MySQL and Templates