滚动内容问题onclick jQuery

时间:2014-09-22 14:12:39

标签: jquery html5 css3 scroll frontend

我有滚动问题你可以看到这个网站 http://client-acumenadagency.com/zois/index.html

当您滚动索引并滚动关于我们时,此部分会向上显示底部内容区域中的某些区域,但我不会显示。我需要全屏内容区域。我附上一个简短的屏幕,希望你能理解。

当我一次又一次地执行此操作时,我也遇到问题,而不是从顶部隐藏我的导航栏,以便如何解决此问题?

这是我正在使用的jQuery代码

$(function() {
  // Stick the #nav to the top of the window
  var nav = $('.top-navigation');
  var navHomeY = nav.offset().top;
  var isFixed = false;
  var $w = $(window);
  $w.scroll(function() {
    var scrollTop = $w.scrollTop();
    var shouldBeFixed = scrollTop > navHomeY;
    if (shouldBeFixed && !isFixed) {
        nav.css({
            position: 'fixed',
            top: 0,
            left: nav.offset().left,
            width: nav.width()
        });
        isFixed = true;
    }
    else if (!shouldBeFixed && isFixed)
    {
        nav.css({
            position: 'static'
        });
        isFixed = false;
    }
  });
});

0 个答案:

没有答案