jQuery scrollTo:获取链接以滚动到固定导航下方

时间:2016-03-28 17:18:21

标签: javascript jquery twitter-bootstrap scrollto

我已经为这个即将推出的网站(http://rvwinvesting.com/2016/)提供了一个固定导航(用于桌面)但是现在在桌面上,导航栏中的链接并强制div滚动到非常顶部的页面。所以它的一部分似乎被切断了。

我希望直接在导航栏下滚动,以便您可以看到div内容的开头。不确定如何实现,因为如果我只是说顶部+ 100,它将滚动到屏幕的顶部+ 100像素在所有屏幕上,我只需要它用于台式机/笔记本电脑。以下是我目前用于使效果有效的内容:

describe("Awesome Controller Tests", function() {

    beforeEach(module('myApp.myModule'));

    var vm, awesomeService, $q, $rootScope;

    beforeEach(inject(function($controller, _awesomeService_, _$q_, _$rootScope_) {
      $q = _$q_;
      awesomeService = _awesomeService_;
      $rootScope = _$rootScope_;
      vm = $controller('Awesome');
    }));

    it("Should return an awesome message", function () {
      spyOn(awesomeService, "awesomeThingToDo").and.returnValue(
          $q.when({
            awesomeMessage: 'awesome message'
          }));

      vm.awesomeThingToDo(); 

      // at this time, the then() callback hasn't been called yet: 
      // it's called at the next digest loop, that we will trigger

      $rootScope.$apply();

      // now the then() callback should have been called and initialized 
      // the message in the controller with the message of the promise
      // returned by the service

      expect(vm.awesomeMessage).toBe('awesome message');
    });

});

0 个答案:

没有答案