If you put a breakpoint in the last part of #home.click()
, you see that it is hidden. Before continuing, you can move the mouse outside the screen and the button is hidden. Put another breakpoint near $('#home').fadeTo(100,0.5)}
and you see it gets invoked when your mouse hovers the page, which will thus automatically make the home button appear. Inspecting jQuery it appears to be on mouseout, probably part of the hover mechanism.
As suggested in the comments, use more CSS instead of JS.
See if this gets you started:
#home, .navitem {
cursor: pointer;
}
#home {
opacity: 0.5;
-webkit-transition: opacity linear 100ms;
}
#home:hover {
opacity: 1;
}
#navbar.docked {
top: auto;
left: 0px;
....
}
JS
function attach_nav() {
$('.navitem').click(function(){
$('#navbar').addClass('docked');
});