From 399a222633d51f0122326c4c5a3cc7a061bb52aa Mon Sep 17 00:00:00 2001 From: ExostFlash Date: Thu, 10 Jul 2025 14:01:05 +0200 Subject: [PATCH] Scrool to top --- cypress/e2e/scroll.cy.js | 18 +++++++++++ scroll-to-top.html | 66 ++++++++++++++++++++++++++++++++++++++++ 2 files changed, 84 insertions(+) create mode 100644 cypress/e2e/scroll.cy.js create mode 100644 scroll-to-top.html diff --git a/cypress/e2e/scroll.cy.js b/cypress/e2e/scroll.cy.js new file mode 100644 index 0000000..ef042fa --- /dev/null +++ b/cypress/e2e/scroll.cy.js @@ -0,0 +1,18 @@ +describe('template spec', () => { + beforeEach(() => { + cy.visit('./../scroll-to-top.html') + }) + + it('Apparition button scroll top', () => { + cy.scrollTo('bottom') + cy.get('div.fixed[ x-data ]').should('be.visible') + }) + + it('Retour en haut et disparition du bouton scroll top', () => { + cy.scrollTo('bottom') + cy.get('div.fixed[ x-data ]').should('be.visible') + cy.get('div.fixed[ x-data ] button').click() + cy.window().its('scrollY').should('eq', 0) + cy.get('div.fixed[ x-data ]').should('not.be.visible') + }) +}) \ No newline at end of file diff --git a/scroll-to-top.html b/scroll-to-top.html new file mode 100644 index 0000000..f3bb4d0 --- /dev/null +++ b/scroll-to-top.html @@ -0,0 +1,66 @@ + + + + + + Scroll to top, with Tailwind CSS + + + + + + + + + + + + + + + + + +
+ +
+ +
+
+ +

Scroll top fixed button

+

Alpine JS & Tailwind CSS

+
+
+ +
+ +
+ + + + \ No newline at end of file