Skip to content

Commit

Permalink
Fixed bug(s) where the hover box goes completely off the nav menu.
Browse files Browse the repository at this point in the history
  • Loading branch information
JeffreyWay committed Mar 8, 2010
1 parent d695abf commit 00add66
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 13 deletions.
4 changes: 3 additions & 1 deletion css/style.css
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,8 @@ ul, li {
#nav li {
float: left;
list-style: none;
border-right: 1px solid black;
border-right: 1px solid #4a4a4a;
border-left: 1px solid black;

}

Expand All @@ -43,6 +44,7 @@ border-right: 1px solid black;
font-family: helvetica, arial, sans-serif;
text-decoration: none;
padding: 30px 45px;
width: 100%;
}

#selected {
Expand Down
26 changes: 14 additions & 12 deletions js/scripts.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,17 +21,19 @@ Site.prototype.navBlob = function() {
nav.hover(function() {
clearTimeout(reset);
$(this).mousemove(function(e) {
blob.animate(
{
width : $(e.target).parent('li').width(),
left : e.pageX - $(e.target).parent('li').width() / 2
},
{
duration: 'slow',
easing : 'easeOutCirc',
queue : false
}
);
console.log('pageX: ' + e.pageX + '; navWidth: ' + nav.width());
blob.animate(
{
width : $(e.target).width(),
left : (e.pageX > nav.width()) ? blob.left : e.pageX - $(e.target).parent('li').width() / 2
},
{
duration: 'slow',
easing : 'easeOutCirc',
queue : false
}
);

}); // end mousemove
}, function(e) {
// mouse out
Expand All @@ -44,7 +46,7 @@ Site.prototype.navBlob = function() {
width : currentPageItem.outerWidth(),
left: currentPageItem.position().left
});
}, 4000);
}, 2000);
});
};
new Site();

0 comments on commit 00add66

Please sign in to comment.