diff --git a/pages/index.vue b/pages/index.vue index e524958ac..4ad32d04e 100644 --- a/pages/index.vue +++ b/pages/index.vue @@ -531,22 +531,16 @@ if (this[key]) this[key] = queries[key]; } }, - observeRequestButton: function () { - let isTheInitialIntersection = true; - const sendButtonElement = this.$refs.sendButton; - const requestElement = this.$refs.request.$el; - const observer = new IntersectionObserver((entries, observer) => { - entries.forEach(entry => { - if (entry.isIntersecting) { - if (!isTheInitialIntersection) { - sendButtonElement.classList.toggle('show'); - } else { - isTheInitialIntersection = false; - } - } - }); - }, {threshold: 1}); - observer.observe(requestElement); + observeRequestButton() { + const requestElement = this.$refs.request.$el; + const sendButton = this.$refs.sendButton; + const observer = new IntersectionObserver((entries, observer) => { + entries.forEach(entry => { + sendButton.className = entry.isIntersecting ? '' : 'show'; + }); + }, { threshold: 1 }); + + observer.observe(requestElement); } }, created() {