Fix affix using stickyfilljs polyfill

This commit is contained in:
Clement Ho 2018-05-21 16:27:34 -05:00
parent 788b035993
commit ecb66fc31c
3 changed files with 8 additions and 8 deletions

View File

@ -1,5 +1,6 @@
import $ from 'jquery';
import _ from 'underscore';
import StickyFill from 'stickyfilljs';
import axios from './lib/utils/axios_utils';
import { visitUrl } from './lib/utils/url_utility';
import bp from './breakpoints';
@ -82,17 +83,11 @@ export default class Job {
/**
If the browser does not support position sticky, it returns the position as static.
If the browser does support sticky, then we allow the browser to handle it, if not
then we default back to Bootstraps affix
then we use a polyfill
**/
if (this.$topBar.css('position') !== 'static') return;
const offsetTop = this.$buildTrace.offset().top;
this.$topBar.affix({
offset: {
top: offsetTop,
},
});
StickyFill.add(this.$topBar);
}
// eslint-disable-next-line class-methods-use-this

View File

@ -75,6 +75,7 @@
"select2": "3.5.2-browserify",
"sha1": "^1.1.1",
"sql.js": "^0.4.0",
"stickyfilljs": "^2.0.5",
"style-loader": "^0.21.0",
"svg4everybody": "2.1.9",
"three": "^0.84.0",

View File

@ -8208,6 +8208,10 @@ statuses@~1.3.1:
version "1.3.1"
resolved "https://registry.yarnpkg.com/statuses/-/statuses-1.3.1.tgz#faf51b9eb74aaef3b3acf4ad5f61abf24cb7b93e"
stickyfilljs@^2.0.5:
version "2.0.5"
resolved "https://registry.yarnpkg.com/stickyfilljs/-/stickyfilljs-2.0.5.tgz#d229e372d2199ddf5d283bbe34ac1f7d2529c2fc"
stream-browserify@^2.0.1:
version "2.0.1"
resolved "https://registry.yarnpkg.com/stream-browserify/-/stream-browserify-2.0.1.tgz#66266ee5f9bdb9940a4e4514cafb43bb71e5c9db"