From ecb66fc31ca21c791f0f0a24032086a8eb580b75 Mon Sep 17 00:00:00 2001 From: Clement Ho Date: Mon, 21 May 2018 16:27:34 -0500 Subject: [PATCH] Fix affix using stickyfilljs polyfill --- app/assets/javascripts/job.js | 11 +++-------- package.json | 1 + yarn.lock | 4 ++++ 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/app/assets/javascripts/job.js b/app/assets/javascripts/job.js index ace45e9dd29..c67bd7fb0c6 100644 --- a/app/assets/javascripts/job.js +++ b/app/assets/javascripts/job.js @@ -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 diff --git a/package.json b/package.json index c2015312560..a2b369985b2 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/yarn.lock b/yarn.lock index 173e751b636..4137d5c8128 100644 --- a/yarn.lock +++ b/yarn.lock @@ -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"