Fixed bugs with nav bar

This commit is contained in:
2015-06-04 19:53:29 +02:00
parent 3162fb00a6
commit aaa837ea26
2 changed files with 10 additions and 16 deletions
+7 -13
View File
@@ -2,10 +2,6 @@
// Taken from: http://codepen.io/mattsince87/pen/exByn
function updateMagicLine($li, $magicLine) {
if ($magicLine.filter(':animated').length > 0) {
return false;
}
active = true;
topPos = $li.position().top;
newHeight = $li.parent().outerHeight();
$magicLine.stop().animate({
@@ -15,7 +11,6 @@ function updateMagicLine($li, $magicLine) {
}
function scrollNav() {
var $el,
leftPos,
newWidth,
@@ -30,16 +25,13 @@ function scrollNav() {
.data("origLeft", $magicLine.position().left)
.data("origHeight", $magicLine.outerHeight());
var clickRunning = false;
$("#navLinks li a").click(function() {
//Toggle Class
$(".active").removeClass("active");
$(this).closest('li').addClass("active");
var theClass = $(this).attr("class");
$('.'+theClass).parent('li').addClass('active');
//Animate
clickRunning = true;
//Animate smooth scrolling to section
$('html, body').stop().animate({
scrollTop: $( $(this).attr('href') ).offset().top
}, 400);
}, 400, function(){clickRunning = false;});
updateMagicLine($(this), $magicLine);
return false;
});
@@ -71,7 +63,9 @@ function scrollNav() {
if (windowPos + (windowHeight / 3)>= divPos && windowPos + (windowHeight / 3) < (divPos + divHeight)) {
$("a[href='" + theID + "']").closest('li').addClass("active");
if (divPos != prevDivPos) {
updateMagicLine($(".active a"), $magicLine);
if (!clickRunning) {
updateMagicLine($(".active a"), $magicLine);
}
prevDivPos = divPos;
}
} else {
+3 -3
View File
@@ -33,12 +33,12 @@ setlocal fml=1
setlocal fdn=20
setlocal fen
silent! normal! zE
let s:l = 1 - ((0 * winheight(0) + 23) / 46)
let s:l = 68 - ((27 * winheight(0) + 23) / 46)
if s:l < 1 | let s:l = 1 | endif
exe s:l
normal! zt
1
normal! 0
68
normal! 040|
tabnext 1
if exists('s:wipebuf')
silent exe 'bwipe ' . s:wipebuf