From a276391b18e113d443716bd719bb9f70e3fd3d99 Mon Sep 17 00:00:00 2001 From: Filipa Lacerda Date: Tue, 2 Jan 2018 21:06:56 +0000 Subject: [PATCH] Cache document query --- app/assets/javascripts/job.js | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/app/assets/javascripts/job.js b/app/assets/javascripts/job.js index f94b0fdbb5e..8f32dcc94e2 100644 --- a/app/assets/javascripts/job.js +++ b/app/assets/javascripts/job.js @@ -100,8 +100,9 @@ export default class Job { } toggleScroll() { - const currentPosition = $(document).scrollTop(); - const scrollHeight = $(document).height(); + const $document = $(document); + const currentPosition = $document.scrollTop(); + const scrollHeight = $document.height(); const windowHeight = $(window).height(); if (this.canScroll()) {