From 2793f5b5e7cf6e6da4f3de33fc6da63f86c5c1ec Mon Sep 17 00:00:00 2001 From: Cristian Davide Conte <64142998+CristianDavideConte@users.noreply.github.com> Date: Mon, 25 Apr 2022 22:21:13 +0200 Subject: [PATCH 01/26] Update README.md --- README.md | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 7afe50e..5035bda 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,12 @@ - + From df6ab76192f90b2dddf6d8bdf2a0565ef17345c2 Mon Sep 17 00:00:00 2001 From: Cristian Davide Conte <64142998+CristianDavideConte@users.noreply.github.com> Date: Wed, 11 May 2022 14:26:19 +0200 Subject: [PATCH 02/26] Update FunctionsAbout.md --- docs/FunctionsAbout.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/FunctionsAbout.md b/docs/FunctionsAbout.md index bc87799..cf2323e 100644 --- a/docs/FunctionsAbout.md +++ b/docs/FunctionsAbout.md @@ -35,7 +35,7 @@ uss.scrollYBy(50, myContainer, () => console.log("Done"), false); - isXScrolling + isXscrolling container @@ -47,7 +47,7 @@ uss.scrollYBy(50, myContainer, () => console.log("Done"), false); - isYScrolling + isYscrolling container From 9af33fb6c94f0dcdda236ad4dc21481443c77061 Mon Sep 17 00:00:00 2001 From: Cristian Davide Conte <64142998+CristianDavideConte@users.noreply.github.com> Date: Wed, 11 May 2022 14:27:22 +0200 Subject: [PATCH 03/26] Update FunctionsAbout.md --- docs/FunctionsAbout.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/FunctionsAbout.md b/docs/FunctionsAbout.md index cf2323e..99cd930 100644 --- a/docs/FunctionsAbout.md +++ b/docs/FunctionsAbout.md @@ -938,7 +938,7 @@ The following table describes every entry of the `Input Parameters` column of th - isXScrolling + isXscrolling container @@ -954,7 +954,7 @@ The following table describes every entry of the `Input Parameters` column of th - isYScrolling + isYscrolling container From b8ebe896f271a871ee9413745091c32154441e10 Mon Sep 17 00:00:00 2001 From: Cristian Davide Conte <64142998+CristianDavideConte@users.noreply.github.com> Date: Wed, 11 May 2022 21:58:30 +0200 Subject: [PATCH 04/26] Update FunctionsAbout.md --- docs/FunctionsAbout.md | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/docs/FunctionsAbout.md b/docs/FunctionsAbout.md index 99cd930..f747f60 100644 --- a/docs/FunctionsAbout.md +++ b/docs/FunctionsAbout.md @@ -105,8 +105,8 @@ uss.scrollYBy(50, myContainer, () => console.log("Done"), false); Returns the direction of the current scroll-animation on the x-axis of the passed container: @@ -122,8 +122,8 @@ uss.scrollYBy(50, myContainer, () => console.log("Done"), false); Returns the direction of the current scroll-animation on the y-axis of the passed container: From 84480fbaa135c7650d85532ba672cdc1e223e280 Mon Sep 17 00:00:00 2001 From: Cristian Davide Conte <64142998+CristianDavideConte@users.noreply.github.com> Date: Thu, 12 May 2022 10:28:02 +0200 Subject: [PATCH 05/26] Update FunctionsAbout.md --- docs/FunctionsAbout.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/docs/FunctionsAbout.md b/docs/FunctionsAbout.md index f747f60..1631c49 100644 --- a/docs/FunctionsAbout.md +++ b/docs/FunctionsAbout.md @@ -33,24 +33,24 @@ uss.scrollYBy(50, myContainer, () => console.log("Done"), false); - + isXscrolling - container + container Returns true if a scroll-animation on the x-axis of the passed container is currently being performed by this API,false otherwise. - + isYscrolling - container + container Returns true if a scroll-animation on the y-axis of the passed container is currently being performed by this API,false otherwise. @@ -936,9 +936,9 @@ The following table describes every entry of the `Input Parameters` column of th - + - isXscrolling + isXscrolling container @@ -952,9 +952,9 @@ The following table describes every entry of the `Input Parameters` column of th - + - isYscrolling + isYscrolling container From f62167ed672408d1e4fcb3df69883d3b4a479165 Mon Sep 17 00:00:00 2001 From: Cristian Davide Conte <64142998+CristianDavideConte@users.noreply.github.com> Date: Mon, 16 May 2022 12:31:27 +0200 Subject: [PATCH 06/26] Update cypress.json --- cypress.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cypress.json b/cypress.json index c8e0ed1..86595cd 100644 --- a/cypress.json +++ b/cypress.json @@ -1,5 +1,5 @@ { "env": { - "testSite": "http://192.168.178.32:8080/" + "testSite": "https://cristiandavideconte.github.io/universalSmoothScroll/" } } From e7163cf573c55e28d2d8fe5f1c225de90e4d0f5c Mon Sep 17 00:00:00 2001 From: Cristian Davide Conte <64142998+CristianDavideConte@users.noreply.github.com> Date: Mon, 16 May 2022 12:56:41 +0200 Subject: [PATCH 07/26] introducing automated testing on linux --- .github/workflows/main.yml | 70 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..a0405d2 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,70 @@ +# This is a basic workflow to help you get started with Actions + +name: uss-tests-ubuntu + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events for beta and master branches + push: + branches: [ master, beta ] + pull_request: + branches: [ master, beta ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + show-installed-browsers: + runs-on: ubuntu-latest + steps: + - name: Show installed browsers + run: cypress info + + chrome-test: + # The type of runner that the job will run on + runs-on: ubuntu-latest + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Checkout + - uses: actions/checkout@v3 + + # Runs a single command using the runners shell + - name: Cypress run + uses: cypress-io/github-action@v2 + with: + browser: chrome + + firefox-test: + # The type of runner that the job will run on + runs-on: ubuntu-latest + container: + image: cypress/browsers:node12.18.3-chrome87-ff82 + options: --user 1001 + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Checkout + - uses: actions/checkout@v3 + + # Runs a single command using the runners shell + - name: Cypress run + uses: cypress-io/github-action@v2 + with: + browser: firefox + edge-test: + # The type of runner that the job will run on + runs-on: ubuntu-latest + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Checkout + - uses: actions/checkout@v3 + + # Runs a single command using the runners shell + - name: Cypress run + uses: cypress-io/github-action@v2 + with: + browser: edge From b8620f55e635dc63a6432c378b7947d65a2f94a7 Mon Sep 17 00:00:00 2001 From: Cristian Davide Conte <64142998+CristianDavideConte@users.noreply.github.com> Date: Mon, 16 May 2022 13:04:01 +0200 Subject: [PATCH 08/26] Update main.yml --- .github/workflows/main.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a0405d2..27dd98c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,5 +1,3 @@ -# This is a basic workflow to help you get started with Actions - name: uss-tests-ubuntu # Controls when the workflow will run @@ -19,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Show installed browsers - run: cypress info + run: echo "test" chrome-test: # The type of runner that the job will run on From bd49605ccb59bc377c762d71af4894147159fcb3 Mon Sep 17 00:00:00 2001 From: Cristian Davide Conte <64142998+CristianDavideConte@users.noreply.github.com> Date: Mon, 16 May 2022 13:06:09 +0200 Subject: [PATCH 09/26] Update main.yml --- .github/workflows/main.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 27dd98c..15260ac 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,7 +17,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Show installed browsers - run: echo "test" + run: cypress info chrome-test: # The type of runner that the job will run on @@ -26,7 +26,7 @@ jobs: steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - name: Checkout - - uses: actions/checkout@v3 + uses: actions/checkout@v3 # Runs a single command using the runners shell - name: Cypress run @@ -45,7 +45,7 @@ jobs: steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - name: Checkout - - uses: actions/checkout@v3 + uses: actions/checkout@v3 # Runs a single command using the runners shell - name: Cypress run @@ -59,7 +59,7 @@ jobs: steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - name: Checkout - - uses: actions/checkout@v3 + uses: actions/checkout@v3 # Runs a single command using the runners shell - name: Cypress run From 2db9d57f443ccce91f4bdd839e5abafc9f28c87f Mon Sep 17 00:00:00 2001 From: Cristian Davide Conte <64142998+CristianDavideConte@users.noreply.github.com> Date: Mon, 16 May 2022 13:10:40 +0200 Subject: [PATCH 10/26] Update main.yml --- .github/workflows/main.yml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 15260ac..174d1cf 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -17,8 +17,10 @@ jobs: runs-on: ubuntu-latest steps: - name: Show installed browsers - run: cypress info - + uses: cypress-io/github-action@v2 + with: + command: cypress info + chrome-test: # The type of runner that the job will run on runs-on: ubuntu-latest From 0794317a6251a65b42ed1bf1f132194fab16c37a Mon Sep 17 00:00:00 2001 From: Cristian Davide Conte <64142998+CristianDavideConte@users.noreply.github.com> Date: Mon, 16 May 2022 13:14:05 +0200 Subject: [PATCH 11/26] Update main.yml --- .github/workflows/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 174d1cf..0a4a582 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -19,6 +19,8 @@ jobs: - name: Show installed browsers uses: cypress-io/github-action@v2 with: + # just perform install + runTests: false command: cypress info chrome-test: From 6f7fa1d3ec0bf4362ab24e2bf148fac8c4d51dab Mon Sep 17 00:00:00 2001 From: Cristian Davide Conte <64142998+CristianDavideConte@users.noreply.github.com> Date: Mon, 16 May 2022 13:14:59 +0200 Subject: [PATCH 12/26] Update main.yml --- .github/workflows/main.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 0a4a582..1c62bb7 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,6 +16,9 @@ jobs: show-installed-browsers: runs-on: ubuntu-latest steps: + - name: Checkout + uses: actions/checkout@v3 + - name: Show installed browsers uses: cypress-io/github-action@v2 with: From 995492456bd65efe7e181897800a829fcb6c347c Mon Sep 17 00:00:00 2001 From: Cristian Davide Conte <64142998+CristianDavideConte@users.noreply.github.com> Date: Mon, 16 May 2022 13:17:08 +0200 Subject: [PATCH 13/26] Update main.yml --- .github/workflows/main.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1c62bb7..84a522f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -24,6 +24,7 @@ jobs: with: # just perform install runTests: false + spec: cypress/integration/*.js command: cypress info chrome-test: From 1652bc480ce67cb72dfedc28e845d1dac71ce959 Mon Sep 17 00:00:00 2001 From: Cristian Davide Conte <64142998+CristianDavideConte@users.noreply.github.com> Date: Mon, 16 May 2022 13:31:04 +0200 Subject: [PATCH 14/26] updated ubuntu tests --- .github/workflows/{main.yml => uss_ubuntu_tests.yml} | 12 ++++++++++++ 1 file changed, 12 insertions(+) rename .github/workflows/{main.yml => uss_ubuntu_tests.yml} (82%) diff --git a/.github/workflows/main.yml b/.github/workflows/uss_ubuntu_tests.yml similarity index 82% rename from .github/workflows/main.yml rename to .github/workflows/uss_ubuntu_tests.yml index 84a522f..e1e03c0 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/uss_ubuntu_tests.yml @@ -18,6 +18,9 @@ jobs: steps: - name: Checkout uses: actions/checkout@v3 + #workaround for creating the package.json file + - name: Setup npm package + run: npm init -y && npm install - name: Show installed browsers uses: cypress-io/github-action@v2 @@ -35,6 +38,9 @@ jobs: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - name: Checkout uses: actions/checkout@v3 + #workaround for creating the package.json file + - name: Setup npm package + run: npm init -y && npm install # Runs a single command using the runners shell - name: Cypress run @@ -54,6 +60,9 @@ jobs: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - name: Checkout uses: actions/checkout@v3 + #workaround for creating the package.json file + - name: Setup npm package + run: npm init -y && npm install # Runs a single command using the runners shell - name: Cypress run @@ -68,6 +77,9 @@ jobs: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - name: Checkout uses: actions/checkout@v3 + #workaround for creating the package.json file + - name: Setup npm package + run: npm init -y && npm install # Runs a single command using the runners shell - name: Cypress run From 468fa5bb179650994fa0c506c6d449a7cd69082b Mon Sep 17 00:00:00 2001 From: Cristian Davide Conte <64142998+CristianDavideConte@users.noreply.github.com> Date: Mon, 16 May 2022 13:35:26 +0200 Subject: [PATCH 15/26] Update uss_ubuntu_tests.yml --- .github/workflows/uss_ubuntu_tests.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/uss_ubuntu_tests.yml b/.github/workflows/uss_ubuntu_tests.yml index e1e03c0..44a7041 100644 --- a/.github/workflows/uss_ubuntu_tests.yml +++ b/.github/workflows/uss_ubuntu_tests.yml @@ -21,7 +21,7 @@ jobs: #workaround for creating the package.json file - name: Setup npm package run: npm init -y && npm install - + # Runs a single command using the runners shell - name: Show installed browsers uses: cypress-io/github-action@v2 with: @@ -41,11 +41,11 @@ jobs: #workaround for creating the package.json file - name: Setup npm package run: npm init -y && npm install - # Runs a single command using the runners shell - name: Cypress run uses: cypress-io/github-action@v2 with: + build: npm i -D cypress browser: chrome firefox-test: @@ -63,11 +63,11 @@ jobs: #workaround for creating the package.json file - name: Setup npm package run: npm init -y && npm install - # Runs a single command using the runners shell - name: Cypress run uses: cypress-io/github-action@v2 with: + build: npm i -D cypress browser: firefox edge-test: # The type of runner that the job will run on @@ -80,9 +80,9 @@ jobs: #workaround for creating the package.json file - name: Setup npm package run: npm init -y && npm install - # Runs a single command using the runners shell - name: Cypress run uses: cypress-io/github-action@v2 with: + build: npm i -D cypress browser: edge From e4e341d53a33431a3b348e02cc7ef5239024845b Mon Sep 17 00:00:00 2001 From: Cristian Davide Conte <64142998+CristianDavideConte@users.noreply.github.com> Date: Mon, 16 May 2022 13:41:28 +0200 Subject: [PATCH 16/26] Update uss_ubuntu_tests.yml --- .github/workflows/uss_ubuntu_tests.yml | 21 --------------------- 1 file changed, 21 deletions(-) diff --git a/.github/workflows/uss_ubuntu_tests.yml b/.github/workflows/uss_ubuntu_tests.yml index 44a7041..bcb9e9b 100644 --- a/.github/workflows/uss_ubuntu_tests.yml +++ b/.github/workflows/uss_ubuntu_tests.yml @@ -13,23 +13,6 @@ on: # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: - show-installed-browsers: - runs-on: ubuntu-latest - steps: - - name: Checkout - uses: actions/checkout@v3 - #workaround for creating the package.json file - - name: Setup npm package - run: npm init -y && npm install - # Runs a single command using the runners shell - - name: Show installed browsers - uses: cypress-io/github-action@v2 - with: - # just perform install - runTests: false - spec: cypress/integration/*.js - command: cypress info - chrome-test: # The type of runner that the job will run on runs-on: ubuntu-latest @@ -51,10 +34,6 @@ jobs: firefox-test: # The type of runner that the job will run on runs-on: ubuntu-latest - container: - image: cypress/browsers:node12.18.3-chrome87-ff82 - options: --user 1001 - # Steps represent a sequence of tasks that will be executed as part of the job steps: # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it From 09f8b174ee7b85a6a7132ccea2e1aac205d87b46 Mon Sep 17 00:00:00 2001 From: Cristian Davide Conte <64142998+CristianDavideConte@users.noreply.github.com> Date: Mon, 16 May 2022 13:43:46 +0200 Subject: [PATCH 17/26] Update uss_ubuntu_tests.yml --- .github/workflows/uss_ubuntu_tests.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/uss_ubuntu_tests.yml b/.github/workflows/uss_ubuntu_tests.yml index bcb9e9b..7860258 100644 --- a/.github/workflows/uss_ubuntu_tests.yml +++ b/.github/workflows/uss_ubuntu_tests.yml @@ -59,6 +59,10 @@ jobs: #workaround for creating the package.json file - name: Setup npm package run: npm init -y && npm install + #install edge + - uses: browser-actions/setup-edge@latest + - name: Print Edge version + run: (Get-Item (Get-Command msedge).Source).VersionInfo.ProductVersion # Runs a single command using the runners shell - name: Cypress run uses: cypress-io/github-action@v2 From d5139f00b7aada664c1d0f642b15f682cd0c01fd Mon Sep 17 00:00:00 2001 From: Cristian Davide Conte <64142998+CristianDavideConte@users.noreply.github.com> Date: Mon, 16 May 2022 13:47:34 +0200 Subject: [PATCH 18/26] added windows tests --- .github/workflows/uss_ubuntu_tests.yml | 3 ++ .github/workflows/uss_windows_tests.yml | 72 +++++++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 .github/workflows/uss_windows_tests.yml diff --git a/.github/workflows/uss_ubuntu_tests.yml b/.github/workflows/uss_ubuntu_tests.yml index 7860258..0a4e228 100644 --- a/.github/workflows/uss_ubuntu_tests.yml +++ b/.github/workflows/uss_ubuntu_tests.yml @@ -48,6 +48,8 @@ jobs: with: build: npm i -D cypress browser: firefox +""" +#not available yet edge-test: # The type of runner that the job will run on runs-on: ubuntu-latest @@ -69,3 +71,4 @@ jobs: with: build: npm i -D cypress browser: edge +""" \ No newline at end of file diff --git a/.github/workflows/uss_windows_tests.yml b/.github/workflows/uss_windows_tests.yml new file mode 100644 index 0000000..20a748a --- /dev/null +++ b/.github/workflows/uss_windows_tests.yml @@ -0,0 +1,72 @@ +name: uss-tests-windows + +# Controls when the workflow will run +on: + # Triggers the workflow on push or pull request events for beta and master branches + push: + branches: [ master, beta ] + pull_request: + branches: [ master, beta ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + chrome-test: + # The type of runner that the job will run on + runs-on: windows-latest + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Checkout + uses: actions/checkout@v3 + #workaround for creating the package.json file + - name: Setup npm package + run: npm init -y && npm install + # Runs a single command using the runners shell + - name: Cypress run + uses: cypress-io/github-action@v2 + with: + build: npm i -D cypress + browser: chrome + + firefox-test: + # The type of runner that the job will run on + runs-on: windows-latest + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Checkout + uses: actions/checkout@v3 + #workaround for creating the package.json file + - name: Setup npm package + run: npm init -y && npm install + # Runs a single command using the runners shell + - name: Cypress run + uses: cypress-io/github-action@v2 + with: + build: npm i -D cypress + browser: firefox + + edge-test: + # The type of runner that the job will run on + runs-on: windows-latest + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Checkout + uses: actions/checkout@v3 + #workaround for creating the package.json file + - name: Setup npm package + run: npm init -y && npm install + #install edge + - uses: browser-actions/setup-edge@latest + - name: Print Edge version + run: (Get-Item (Get-Command msedge).Source).VersionInfo.ProductVersion + # Runs a single command using the runners shell + - name: Cypress run + uses: cypress-io/github-action@v2 + with: + build: npm i -D cypress + browser: edge \ No newline at end of file From 7e33fcf38f9965fc2240cbb31db9507a2aa41b07 Mon Sep 17 00:00:00 2001 From: Cristian Davide Conte <64142998+CristianDavideConte@users.noreply.github.com> Date: Mon, 16 May 2022 13:50:13 +0200 Subject: [PATCH 19/26] Update uss_ubuntu_tests.yml --- .github/workflows/uss_ubuntu_tests.yml | 45 +++++++++++++------------- 1 file changed, 22 insertions(+), 23 deletions(-) diff --git a/.github/workflows/uss_ubuntu_tests.yml b/.github/workflows/uss_ubuntu_tests.yml index 0a4e228..b3a4a7a 100644 --- a/.github/workflows/uss_ubuntu_tests.yml +++ b/.github/workflows/uss_ubuntu_tests.yml @@ -48,27 +48,26 @@ jobs: with: build: npm i -D cypress browser: firefox -""" + #not available yet - edge-test: - # The type of runner that the job will run on - runs-on: ubuntu-latest - # Steps represent a sequence of tasks that will be executed as part of the job - steps: - # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it - - name: Checkout - uses: actions/checkout@v3 - #workaround for creating the package.json file - - name: Setup npm package - run: npm init -y && npm install - #install edge - - uses: browser-actions/setup-edge@latest - - name: Print Edge version - run: (Get-Item (Get-Command msedge).Source).VersionInfo.ProductVersion - # Runs a single command using the runners shell - - name: Cypress run - uses: cypress-io/github-action@v2 - with: - build: npm i -D cypress - browser: edge -""" \ No newline at end of file +# edge-test: +# # The type of runner that the job will run on +# runs-on: ubuntu-latest +# # Steps represent a sequence of tasks that will be executed as part of the job +# steps: +# # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it +# - name: Checkout +# uses: actions/checkout@v3 +# #workaround for creating the package.json file +# - name: Setup npm package +# run: npm init -y && npm install +# #install edge +# - uses: browser-actions/setup-edge@latest +# - name: Print Edge version +# run: (Get-Item (Get-Command msedge).Source).VersionInfo.ProductVersion +# # Runs a single command using the runners shell +# - name: Cypress run +# uses: cypress-io/github-action@v2 +# with: +# build: npm i -D cypress +# browser: edge From d87296d6cecab45023763c6b281145c23047cc90 Mon Sep 17 00:00:00 2001 From: Cristian Davide Conte <64142998+CristianDavideConte@users.noreply.github.com> Date: Mon, 16 May 2022 15:11:40 +0200 Subject: [PATCH 20/26] fixed typos in tests --- cypress/integration/x-axis-getters-tests.js | 4 +-- cypress/integration/x-axis-scroll-tests.js | 35 ++++++++++----------- cypress/integration/y-axis-getters-tests.js | 4 +-- cypress/integration/y-axis-scroll-tests.js | 35 ++++++++++----------- 4 files changed, 38 insertions(+), 40 deletions(-) diff --git a/cypress/integration/x-axis-getters-tests.js b/cypress/integration/x-axis-getters-tests.js index 5979a56..e78aabc 100644 --- a/cypress/integration/x-axis-getters-tests.js +++ b/cypress/integration/x-axis-getters-tests.js @@ -32,7 +32,7 @@ describe("getFinalXPosition-Body", function() { describe("getScrollXDirection-Body", function() { var uss; var scrollYDirectionLeft, scrollYDirectionRight; - it("Checks the getFinalXPosition method", function(){ + it("Checks the getScrollXDirection method", function(){ cy.visit(testSite) cy.window() .then((win) => { @@ -109,7 +109,7 @@ describe("getXStepLength-Body", function() { describe("getMaxScrollX-Body", function() { var uss; - it("Checks the getXStepLength method", function(){ + it("Checks the getMaxScrollX method", function(){ cy.visit(testSite) cy.window() .then((win) => { diff --git a/cypress/integration/x-axis-scroll-tests.js b/cypress/integration/x-axis-scroll-tests.js index b50e9d5..cdcce1b 100644 --- a/cypress/integration/x-axis-scroll-tests.js +++ b/cypress/integration/x-axis-scroll-tests.js @@ -131,6 +131,23 @@ describe("scrollXToBy-StillStart-True-Body", function() { }) }) +describe("scrollXToBy-StillStart-False-Body", function() { + var uss; + it("Horizontally scrolls the body to n1 pixels and then extends that animation by n2 pixels", function(){ + cy.visit(testSite) + cy.window() + .then((win) => { + uss = win.uss; + uss._containersData = new Map(); + return new Cypress.Promise(resolve => { + uss.scrollXTo(100); + uss.scrollXBy(200, uss.getPageScroller(), resolve, false); + }); + }).then(() => { + bodyScrollLeftShouldToBe(300); + }) + }) +}) describe("scrollXToBy-StillStart-False-ExtendedScrollingWhileAnimating-Body", function() { var uss; @@ -185,24 +202,6 @@ describe("scrollXTo-scrollXTo-ReplaceScrollingWhileAnimating-Body", function() { }) }) -describe("scrollXToBy-StillStart-False-Body", function() { - var uss; - it("Horizontally scrolls the body to n1 pixels and then extends that animation by n2 pixels", function(){ - cy.visit(testSite) - cy.window() - .then((win) => { - uss = win.uss; - uss._containersData = new Map(); - return new Cypress.Promise(resolve => { - uss.scrollXTo(100); - uss.scrollXBy(200, uss.getPageScroller(), resolve, false); - }); - }).then(() => { - bodyScrollLeftShouldToBe(300); - }) - }) -}) - describe("isXScrolling-Body", function() { var uss; var wasXScrolling; diff --git a/cypress/integration/y-axis-getters-tests.js b/cypress/integration/y-axis-getters-tests.js index feabf51..0fca681 100644 --- a/cypress/integration/y-axis-getters-tests.js +++ b/cypress/integration/y-axis-getters-tests.js @@ -32,7 +32,7 @@ describe("getFinalYPosition-Body", function() { describe("getScrollYDirection-Body", function() { var uss; var scrollYDirectionUp, scrollYDirectionDown; - it("Checks the getFinalYPosition method", function(){ + it("Checks the getScrollYDirection method", function(){ cy.visit(testSite) cy.window() .then((win) => { @@ -109,7 +109,7 @@ describe("getYStepLength-Body", function() { describe("getMaxScrollY-Body", function() { var uss; - it("Checks the getYStepLength method", function(){ + it("Checks the getMaxScrollY method", function(){ cy.visit(testSite) cy.window() .then((win) => { diff --git a/cypress/integration/y-axis-scroll-tests.js b/cypress/integration/y-axis-scroll-tests.js index a7f77e3..c1f809e 100644 --- a/cypress/integration/y-axis-scroll-tests.js +++ b/cypress/integration/y-axis-scroll-tests.js @@ -131,6 +131,23 @@ describe("scrollYToBy-StillStart-True-Body", function() { }) }) +describe("scrollYToBy-StillStart-False-Body", function() { + var uss; + it("Vertically scrolls the body to n1 pixels and then extends that animation by n2 pixels", function(){ + cy.visit(testSite) + cy.window() + .then((win) => { + uss = win.uss; + uss._containersData = new Map(); + return new Cypress.Promise(resolve => { + uss.scrollYTo(100); + uss.scrollYBy(200, uss.getPageScroller(), resolve, false); + }); + }).then(() => { + bodyScrollTopShouldToBe(300); + }) + }) +}) describe("scrollYToBy-StillStart-False-ExtendedScrollingWhileAnimating-Body", function() { var uss; @@ -185,24 +202,6 @@ describe("scrollYTo-scrollYTo-ReplaceScrollingWhileAnimating-Body", function() { }) }) -describe("scrollYToBy-StillStart-False-Body", function() { - var uss; - it("Vertically scrolls the body to n1 pixels and then extends that animation by n2 pixels", function(){ - cy.visit(testSite) - cy.window() - .then((win) => { - uss = win.uss; - uss._containersData = new Map(); - return new Cypress.Promise(resolve => { - uss.scrollYTo(100); - uss.scrollYBy(200, uss.getPageScroller(), resolve, false); - }); - }).then(() => { - bodyScrollTopShouldToBe(300); - }) - }) -}) - describe("isYScrolling-Body", function() { var uss; var wasYScrolling; From f530fc5e87e6ae844427ed287512e09a9b0a89f0 Mon Sep 17 00:00:00 2001 From: Cristian Davide Conte <64142998+CristianDavideConte@users.noreply.github.com> Date: Mon, 16 May 2022 15:28:36 +0200 Subject: [PATCH 21/26] updated cypress tests timeouts --- cypress.json | 3 ++- cypress/integration/x-axis-getters-tests.js | 1 + cypress/integration/x-axis-scroll-tests.js | 7 ++++--- cypress/integration/x-axis-setters-tests.js | 1 + cypress/integration/y-axis-getters-tests.js | 1 + cypress/integration/y-axis-scroll-tests.js | 1 + cypress/integration/y-axis-setters-tests.js | 1 + 7 files changed, 11 insertions(+), 4 deletions(-) diff --git a/cypress.json b/cypress.json index 86595cd..8eed093 100644 --- a/cypress.json +++ b/cypress.json @@ -1,5 +1,6 @@ { "env": { - "testSite": "https://cristiandavideconte.github.io/universalSmoothScroll/" + "testSite": "https://cristiandavideconte.github.io/universalSmoothScroll/" , + "preferredTimeout": 15000 } } diff --git a/cypress/integration/x-axis-getters-tests.js b/cypress/integration/x-axis-getters-tests.js index e78aabc..29d8f1d 100644 --- a/cypress/integration/x-axis-getters-tests.js +++ b/cypress/integration/x-axis-getters-tests.js @@ -1,3 +1,4 @@ +Cypress.config("defaultCommandTimeout", Cypress.env("preferredTimeout")); var testSite = Cypress.env("testSite") function bodyScrollLeftShouldToBe(value) { diff --git a/cypress/integration/x-axis-scroll-tests.js b/cypress/integration/x-axis-scroll-tests.js index cdcce1b..4f36375 100644 --- a/cypress/integration/x-axis-scroll-tests.js +++ b/cypress/integration/x-axis-scroll-tests.js @@ -1,3 +1,4 @@ +Cypress.config("defaultCommandTimeout", Cypress.env("preferredTimeout")); var testSite = Cypress.env("testSite") function bodyScrollLeftShouldToBe(value) { @@ -33,7 +34,7 @@ describe("scrollXTo-immediatelyStoppedScrolling-Body", function() { uss = win.uss; uss._containersData = new Map(); return new Cypress.Promise(resolve => { - uss.scrollXTo(500, uss.getPageScroller(), () => count++); + uss.scrollXTo(500, uss.getPageScroller(), () => {count += 1;}); uss.stopScrollingX(uss.getPageScroller(), resolve); }); }).then(() => { @@ -54,10 +55,10 @@ describe("scrollXToBy-immediatelyStoppedScrolling-Body", function() { uss = win.uss; uss._containersData = new Map(); return new Cypress.Promise(resolve => { - uss.scrollXTo(500, uss.getPageScroller(), () => count++); + uss.scrollXTo(500, uss.getPageScroller(), () => {count += 1;}); uss.stopScrollingX(uss.getPageScroller()); uss.scrollXTo(250, uss.getPageScroller(), () => { - count++; + count += 1; resolve(); }); }); diff --git a/cypress/integration/x-axis-setters-tests.js b/cypress/integration/x-axis-setters-tests.js index cce08fe..41328c0 100644 --- a/cypress/integration/x-axis-setters-tests.js +++ b/cypress/integration/x-axis-setters-tests.js @@ -1,3 +1,4 @@ +Cypress.config("defaultCommandTimeout", Cypress.env("preferredTimeout")); var testSite = Cypress.env("testSite") function bodyScrollLeftShouldToBe(value) { diff --git a/cypress/integration/y-axis-getters-tests.js b/cypress/integration/y-axis-getters-tests.js index 0fca681..d68c342 100644 --- a/cypress/integration/y-axis-getters-tests.js +++ b/cypress/integration/y-axis-getters-tests.js @@ -1,3 +1,4 @@ +Cypress.config("defaultCommandTimeout", Cypress.env("preferredTimeout")); var testSite = Cypress.env("testSite") function bodyScrollTopShouldToBe(value) { diff --git a/cypress/integration/y-axis-scroll-tests.js b/cypress/integration/y-axis-scroll-tests.js index c1f809e..d93185d 100644 --- a/cypress/integration/y-axis-scroll-tests.js +++ b/cypress/integration/y-axis-scroll-tests.js @@ -1,3 +1,4 @@ +Cypress.config("defaultCommandTimeout", Cypress.env("preferredTimeout")); var testSite = Cypress.env("testSite") function bodyScrollTopShouldToBe(value) { diff --git a/cypress/integration/y-axis-setters-tests.js b/cypress/integration/y-axis-setters-tests.js index ba6f8c9..f284b92 100644 --- a/cypress/integration/y-axis-setters-tests.js +++ b/cypress/integration/y-axis-setters-tests.js @@ -1,3 +1,4 @@ +Cypress.config("defaultCommandTimeout", Cypress.env("preferredTimeout")); var testSite = Cypress.env("testSite") function bodyScrollTopShouldToBe(value) { From 554e1b94199b22d0b07fa990e24cc8faf5ffdfbf Mon Sep 17 00:00:00 2001 From: Cristian Davide Conte <64142998+CristianDavideConte@users.noreply.github.com> Date: Tue, 17 May 2022 12:06:01 +0200 Subject: [PATCH 22/26] Update FunctionsAbout.md --- docs/FunctionsAbout.md | 4362 +++++++++++++++++++++------------------- 1 file changed, 2255 insertions(+), 2107 deletions(-) diff --git a/docs/FunctionsAbout.md b/docs/FunctionsAbout.md index 1631c49..41342e3 100644 --- a/docs/FunctionsAbout.md +++ b/docs/FunctionsAbout.md @@ -1,2128 +1,2276 @@ -#### ⇦ Back to Table of Contents -
+#### ⇦ Back to Table of Contents +
# Available Functions -Once imported, the [`universalsmoothscroll-min.js`](./Download.md) script will automatically declare and initialize _(in the global scope of your application)_ the `uss` object.
-This object has the below listed properties and they are the core functionalities of the UniversalSmoothScroll API.
-Each one of these functions can be invoked in this way: `uss.NAME_OF_THE_FUNCTION(param1, param2, ...)`.
+Once imported, the [`universalsmoothscroll-min.js`](./Download.md) script will automatically declare and initialize _(in +the global scope of your application)_ the `uss` object.
+This object has the below listed properties and they are the core functionalities of the UniversalSmoothScroll API. +
+Each one of these functions can be invoked in this way: `uss.NAME_OF_THE_FUNCTION(param1, param2, ...)`.
For instance: ```javascript /** - * In this example: - * - an ease-out StepLengthCalculator is first set to control - * the scroll-animations on the y-axis of myContainer. - * - the API is requested to scroll the y-axis of myContainer to 500px and - * log "dOnE" when finished. - * - the API is requested to extend the scroll-animation by 50px and - * log "Done" instead of "dOnE" when finished. - */ +* In this example: +* - an ease-out StepLengthCalculator is first set to control +* the scroll-animations on the y-axis of myContainer. +* - the API is requested to scroll the y-axis of myContainer to 500px and +* log "dOnE" when finished. +* - the API is requested to extend the scroll-animation by 50px and +* log "Done" instead of "dOnE" when finished. +*/ uss.setYStepLengthCalculator((r) => {return r / 20 + 1;}, myContainer); -uss.scrollYTo(500, myContainer, () => console.log("dOnE")); -uss.scrollYBy(50, myContainer, () => console.log("Done"), false); +uss.scrollYTo(500, myContainer, () => console.log("dOnE")); +uss.scrollYBy(50, myContainer, () => console.log("Done"), false); ``` -
-
+
+
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameInput ParametersDescription
- isXscrolling - - container - - Returns true if a scroll-animation on the x-axis of the passed container is currently being performed by this API,false otherwise. -
- isYscrolling - - container - - Returns true if a scroll-animation on the y-axis of the passed container is currently being performed by this API,false otherwise. -
- isScrolling - - container - - Returns true if a scroll-animation on any axis of the passed container is currently being performed by this API,false otherwise. -
- getFinalXPosition - - container - - Returns the position (in px) at which the passed container will be at the end of the scroll-animation on the x-axis.
- The current position is returned if no scroll-animation is in place. -
- getFinalYPosition - - container - - Returns the position (in px) at which the passed container will be at the end of the scroll-animation on the y-axis.
- The current position is returned if no scroll-animation is in place. -
- getScrollXDirection - - container - - Returns the direction of the current scroll-animation on the x-axis of the passed container: -
    -
  • 1 if its scrollLeft/scrollX will increase.
  • -
  • -1 if its scrollLeft/scrollX will decrease.
  • -
  • 0 if there's no scroll-animation.
  • -
-
- getScrollYDirection - - container - - Returns the direction of the current scroll-animation on the y-axis of the passed container: -
    -
  • 1 if its scrollTop/scrollY will increase.
  • -
  • -1 if its scrollTop/scrollY will decrease.
  • -
  • 0 if there's no scroll-animation.
  • -
-
- getXStepLengthCalculator - - container - - Returns the current StepLengthCalculator which controls the animations on the x-axis of the passed container if available. -
- getTemporary -
- getYStepLengthCalculator - - container - - Returns the current StepLengthCalculator which controls the animations on the y-axis of the passed container if available. -
- getTemporary -
- getXStepLength - - / - - Returns the value of the _xStepLength property. -
- getYStepLength - - / - - Returns the value of the _yStepLength property. -
- getMinAnimationFrame - - / - - Returns the value of the _minAnimationFrame property. -
- getWindowHeight - - / - - Returns the value of the _windowHeight property. -
- getWindowWidth - - / - - Returns the value of the _windowWidth property. -
- getScrollbarsMaxDimension - - / - - Returns the value of the _scrollbarsMaxDimension property. -
- getPageScroller - - / - - Returns the value of the _pageScroller property. -
- getReducedMotionState - - / - - Returns the value of the _reducedMotion property. -
- getDebugMode - - / - - Returns the value of the _debugMode property. -
- setXStepLengthCalculator - - newCalculator - - Sets the StepLengthCalculator for (the x-axis of) the passed container if compatible. -
- container -
- isTemporary -
- setYStepLengthCalculator - - newCalculator - - Sets the StepLengthCalculator for (the y-axis of) the passed container if compatible. -
- container -
- isTemporary -
- setStepLengthCalculator - - newCalculator - - Sets the StepLengthCalculator for (both the y and x axes of) the passed container if compatible. -
- container -
- isTemporary -
- setXStepLength - - newXStepLength - - Sets the _xStepLength property to the passed value if compatible. -
- setYStepLength - - newYStepLength - - Sets the _yStepLength property to the passed value if compatible. -
- setStepLength - - newStepLength - - Sets both the _xStepLength and _yStepLength properties to the passed value if compatible. -
- setMinAnimationFrame - - newMinAnimationFrame - - Sets the _minAnimationFrame property to the passed value if compatible. -
- setPageScroller - - newPageScroller - - Sets the _pageScroller property to the passed value if compatible. -
- setDebugMode - - newDebugMode - - Sets the _debugMode property to the passed value if compatible. -
- calcXStepLength - - deltaX - - Returns how long each animation-step on the x-axis must be in order to target the _minAnimationFrame property value.
- This function can be considered the default StepLengthCalculator for any scroll-animation on the x-axis of any container. -
- calcYStepLength - - deltaY - - Returns how long each animation-step on the y-axis must be in order to target the _minAnimationFrame property value.
- This function can be considered the default StepLengthCalculator for any scroll-animation on the y-axis of any container. -
- calcScrollbarsDimensions - - element - - Returns an array containing 2 numbers: -
    -
  1. Contains the vertical scrollbar's width (in px) of the passed element.
  2. -
  3. Contains the horizontal scrollbar's height (in px) of the passed element.
  4. -
-
- calcBordersDimensions - - element - - Returns an array containing 4 numbers: -
    -
  1. Contains the top border's height (in px) of the passed element.
  2. -
  3. Contains the right border's width (in px) of the passed element.
  4. -
  5. Contains the bottom border's height (in px) of the passed element.
  6. -
  7. Contains the left border's width (in px) of the passed element.
  8. -
- The returned border sizes don't take into consideration the css "transform" property's effects. -
- getScrollXCalculator - - container - - Returns a function that returns: -
    -
  • The scrollLeft property of the passed container if it's an instance of HTMLElement.
  • -
  • The scrollX property of the passed container if it's the window element.
  • -
-
- getScrollYCalculator - - container - - Returns a function that returns: -
    -
  • The scrollTop property of the passed container if it's an instance of HTMLElement.
  • -
  • The scrollY property of the passed container if it's the window element.
  • -
-
- getMaxScrollX - - container - - Returns the highest reacheable scrollLeft/scrollX value of the passed container. -
- getMaxScrollY - - container - - Returns the highest reacheable scrollTop/scrollY value of the passed container. -
- getXScrollableParent - - element - - Returns the first scrollable container (on the x-axis) of the passed element or null if it doesn't have one. -
- includeHiddenParents -
- getYScrollableParent - - element - - Returns the first scrollable container (on the y-axis) of the passed element or null if it doesn't have one. -
- includeHiddenParents -
- getScrollableParent - - element - - Returns the first scrollable container (on either the x or y axis) of the passed element or null if it doesn't have one. -
- includeHiddenParents -
- getAllScrollableParents - - element - - Returns an array containing all the scrollable containers (on either the x or y axis) of the passed element. -
- includeHiddenParents -
- callback -
- scrollXTo - - finalXPosition - - Scrolls the x-axis of the passed container to the specified position (in px) if possible. -
- container -
- callback -
- scrollYTo - - finalYPosition - - Scrolls the y-axis of the passed container to the specified position (in px) if possible. -
- container -
- callback -
- scrollXBy - - deltaX - - Scrolls the x-axis the passed container by the specified amount of pixels if possible. -
- container -
- callback -
- stillStart -
- scrollYBy - - deltaY - - Scrolls the y-axis the passed container by the specified amount of pixels if possible. -
- container -
- callback -
- stillStart -
- scrollTo - - finalXPosition - - Scrolls both the x and y axes of the passed container to the specified positions (in px) if possible. -
- finalYPosition -
- container -
- callback -
- scrollBy - - deltaX - - Scrolls both the x and y axes of the passed container by the specified amounts of pixels if possible. -
- deltaY -
- container -
- callback -
- stillStart -
- scrollIntoView - - element - - Scrolls all the scrollable parents of the passed element in order to make it visible on the screen with the specified alignments. -
- alignToLeft -
- alignToTop -
- callback -
- includeHiddenParents -
- scrollIntoViewIfNeeded - - element - - Scrolls all the scrollable parents of the passed element in order to make it visible on the screen with the specified alignment only if it's not already visible. -
- alignToCenter -
- callback -
- includeHiddenParents -
- stopScrollingX - - container - - Stops the current scroll-animation on the x-axis of the passed container. -
- callback -
- stopScrollingY - - container - - Stops the current scroll-animation on the y-axis of the passed container. -
- callback -
- stopScrolling - - container - - Stops the current scroll-animations on both the x and y axes of the passed container. -
- callback -
- stopScrollingAll - - callback - - Stops all the current scroll-animations on both the x and y axes of all the containers. -
- hrefSetup - - alignToLeft - - Automatically binds every valid anchor (<a> and <area> in the DOM) to the corresponding element that should be scrolled into view.
- Whenever a valid anchor is clicked the passed init function is invoked and if it doesn't return false, a scroll-animation will bring into view the linked element and the browser's history will be updated (if requested). -
- alignToTop -
- init -
- callback -
- includeHiddenParents -
- updateHistory -
NameInput ParametersDescription
+ isXscrolling + + container + + Returns true if a scroll-animation on the x-axis of the passed container is currently being + performed by this API,false otherwise. +
+ isYscrolling + + container + + Returns true if a scroll-animation on the y-axis of the passed container is currently being + performed by this API,false otherwise. +
+ isScrolling + + container + + Returns true if a scroll-animation on any axis of the passed container is currently being performed + by this API,false otherwise. +
+ getFinalXPosition + + container + + Returns the position (in px) at which the passed container will be at the end of the scroll-animation on + the x-axis.
+ The current position is returned if no scroll-animation is in place. +
+ getFinalYPosition + + container + + Returns the position (in px) at which the passed container will be at the end of the scroll-animation on + the y-axis.
+ The current position is returned if no scroll-animation is in place. +
+ getScrollXDirection + + container + + Returns the direction of the current scroll-animation on the x-axis of the passed container: +
    +
  • 1 if its scrollLeft/scrollX will increase.
  • +
  • -1 if its scrollLeft/scrollX will decrease.
  • +
  • 0 if there's no scroll-animation.
  • +
+
+ getScrollYDirection + + container + + Returns the direction of the current scroll-animation on the y-axis of the passed container: +
    +
  • 1 if its scrollTop/scrollY will increase.
  • +
  • -1 if its scrollTop/scrollY will decrease.
  • +
  • 0 if there's no scroll-animation.
  • +
+
+ getXStepLengthCalculator + + container + + Returns the current StepLengthCalculator + which controls the animations on the x-axis of the passed container if available. +
+ getTemporary +
+ getYStepLengthCalculator + + container + + Returns the current StepLengthCalculator + which controls the animations on the y-axis of the passed container if available. +
+ getTemporary +
+ getXStepLength + + / + + Returns the value of the _xStepLength property. +
+ getYStepLength + + / + + Returns the value of the _yStepLength property. +
+ getMinAnimationFrame + + / + + Returns the value of the _minAnimationFrame property. +
+ getWindowHeight + + / + + Returns the value of the _windowHeight property. +
+ getWindowWidth + + / + + Returns the value of the _windowWidth property. +
+ getScrollbarsMaxDimension + + / + + Returns the value of the _scrollbarsMaxDimension property. +
+ getPageScroller + + / + + Returns the value of the _pageScroller property. +
+ getReducedMotionState + + / + + Returns the value of the _reducedMotion property. +
+ getDebugMode + + / + + Returns the value of the _debugMode property. +
+ setXStepLengthCalculator + + newCalculator + + Sets the StepLengthCalculator for (the + x-axis of) the passed container if compatible. +
+ container +
+ isTemporary +
+ shouldBeTested +
+ setYStepLengthCalculator + + newCalculator + + Sets the StepLengthCalculator for (the + y-axis of) the passed container if compatible. +
+ container +
+ isTemporary +
+ shouldBeTested +
+ setStepLengthCalculator + + newCalculator + + Sets the StepLengthCalculator for (both + the y and x axes of) the passed container if compatible. +
+ container +
+ isTemporary +
+ shouldBeTested +
+ setXStepLength + + newXStepLength + + Sets the _xStepLength property to the passed value if compatible. +
+ setYStepLength + + newYStepLength + + Sets the _yStepLength property to the passed value if compatible. +
+ setStepLength + + newStepLength + + Sets both the _xStepLength and _yStepLength properties to the passed value if + compatible. +
+ setMinAnimationFrame + + newMinAnimationFrame + + Sets the _minAnimationFrame property to the passed value if compatible. +
+ setPageScroller + + newPageScroller + + Sets the _pageScroller property to the passed value if compatible. +
+ setDebugMode + + newDebugMode + + Sets the _debugMode property to the passed value if compatible. +
+ calcXStepLength + + deltaX + + Returns how long each animation-step on the x-axis must be in order to target the + _minAnimationFrame property value.
+ This function can be considered the default StepLengthCalculator for any + scroll-animation on the x-axis of any container. +
+ calcYStepLength + + deltaY + + Returns how long each animation-step on the y-axis must be in order to target the + _minAnimationFrame property value.
+ This function can be considered the default StepLengthCalculator for any + scroll-animation on the y-axis of any container. +
+ calcScrollbarsDimensions + + element + + Returns an array containing 2 numbers: +
    +
  1. Contains the vertical scrollbar's width (in px) of the passed element.
  2. +
  3. Contains the horizontal scrollbar's height (in px) of the passed element.
  4. +
+
+ calcBordersDimensions + + element + + Returns an array containing 4 numbers: +
    +
  1. Contains the top border's height (in px) of the passed element.
  2. +
  3. Contains the right border's width (in px) of the passed element.
  4. +
  5. Contains the bottom border's height (in px) of the passed element.
  6. +
  7. Contains the left border's width (in px) of the passed element.
  8. +
+ The returned border sizes don't take into consideration the css "transform" property's effects. +
+ getScrollXCalculator + + container + + Returns a function that returns: +
    +
  • The scrollLeft property of the passed container if it's an instance of HTMLElement.
  • +
  • The scrollX property of the passed container if it's the window element.
  • +
+
+ getScrollYCalculator + + container + + Returns a function that returns: +
    +
  • The scrollTop property of the passed container if it's an instance of HTMLElement.
  • +
  • The scrollY property of the passed container if it's the window element.
  • +
+
+ getMaxScrollX + + container + + Returns the highest reacheable scrollLeft/scrollX value of the passed container. +
+ getMaxScrollY + + container + + Returns the highest reacheable scrollTop/scrollY value of the passed container. +
+ getXScrollableParent + + element + + Returns the first scrollable container (on the x-axis) of the passed element or null if it doesn't have + one. +
+ includeHiddenParents +
+ getYScrollableParent + + element + + Returns the first scrollable container (on the y-axis) of the passed element or null if it doesn't have + one. +
+ includeHiddenParents +
+ getScrollableParent + + element + + Returns the first scrollable container (on either the x or y axis) of the passed element or null if it + doesn't have one. +
+ includeHiddenParents +
+ getAllScrollableParents + + element + + Returns an array containing all the scrollable containers (on either the x or y axis) of the passed + element. +
+ includeHiddenParents +
+ callback +
+ scrollXTo + + finalXPosition + + Scrolls the x-axis of the passed container to the specified position (in px) if possible. +
+ container +
+ callback +
+ scrollYTo + + finalYPosition + + Scrolls the y-axis of the passed container to the specified position (in px) if possible. +
+ container +
+ callback +
+ scrollXBy + + deltaX + + Scrolls the x-axis the passed container by the specified amount of pixels if possible. +
+ container +
+ callback +
+ stillStart +
+ scrollYBy + + deltaY + + Scrolls the y-axis the passed container by the specified amount of pixels if possible. +
+ container +
+ callback +
+ stillStart +
+ scrollTo + + finalXPosition + + Scrolls both the x and y axes of the passed container to the specified positions (in px) if possible. +
+ finalYPosition +
+ container +
+ callback +
+ scrollBy + + deltaX + + Scrolls both the x and y axes of the passed container by the specified amounts of pixels if possible. +
+ deltaY +
+ container +
+ callback +
+ stillStart +
+ scrollIntoView + + element + + Scrolls all the scrollable parents of the passed element in order to make it visible on the screen with the + specified alignments. +
+ alignToLeft +
+ alignToTop +
+ callback +
+ includeHiddenParents +
+ scrollIntoViewIfNeeded + + element + + Scrolls all the scrollable parents of the passed element in order to make it visible on the screen with the + specified alignment only if it's not already visible. +
+ alignToCenter +
+ callback +
+ includeHiddenParents +
+ stopScrollingX + + container + + Stops the current scroll-animation on the x-axis of the passed container. +
+ callback +
+ stopScrollingY + + container + + Stops the current scroll-animation on the y-axis of the passed container. +
+ callback +
+ stopScrolling + + container + + Stops the current scroll-animations on both the x and y axes of the passed container. +
+ callback +
+ stopScrollingAll + + callback + + Stops all the current scroll-animations on both the x and y axes of all the containers. +
+ hrefSetup + + alignToLeft + + Automatically binds every valid anchor (<a> and <area> in the DOM) to the + corresponding element that should be scrolled into view.
+ Whenever a valid anchor is clicked the passed init function is invoked and if it doesn't return + false, a scroll-animation will bring into view the linked element and the browser's history will be + updated (if requested). +
+ alignToTop +
+ init +
+ callback +
+ includeHiddenParents +
+ updateHistory +
--- -
+
# Input parameters details The following table describes every entry of the `Input Parameters` column of the table above. -
-
+
+
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameParameter NameParameter TypeParameter Description
- isXscrolling - - container - - Object - - An HTMLElement or the window element. -
- isYscrolling - - container - - Object - - An HTMLElement or the window element. -
- isScrolling - - container - - Object - - An HTMLElement or the window element. -
- getFinalXPosition - - container - - Object - - An HTMLElement or the window element. -
- getFinalYPosition - - container - - Object - - An HTMLElement or the window element. -
- getScrollXDirection - - container - - Object - - An HTMLElement or the window element. -
- getScrollYDirection - - container - - Object - - An HTMLElement or the window element. -
- getXStepLengthCalculator - - container - - Object - - An HTMLElement or the window element. -
- getTemporary - - Boolean - - If true the returned StepLengthCalculator is the temporary one set for the x-axis of this container, otherwise it's the standard one. -
- getYStepLengthCalculator - - container - - Object - - An HTMLElement or the window element. -
- getTemporary - - Boolean - - If true the returned StepLengthCalculator is the temporary one set for the y-axis of this container, otherwise it's the standard one. -
- setXStepLengthCalculator - - newCalculator - - Function - - A valid StepLengthCalculator. -
- container - - Object - - An HTMLElement or the window element. -
- isTemporary - - Boolean - - If true, newCalculator will control only the next scroll-animation on the x-axis of this container and it will be automatically discarded at the end of it.
- If false every scroll-animation on the x-axis of this container will be controlled by newCalculator.
- If a container has both a temporary and non-temporary StepLengthCalculator set for its x-axis, the temporary one will controll the next scroll-animation on the x-axis of the container.
- Setting a temporary StepLengthCalculator will only overwrite the previous temporary one.
- Setting a non-temporary StepLengthCalculator will overwrite the previous non-temporary one and discard any temporary one.
-
- setYStepLengthCalculator - - newCalculator - - Function - - A valid StepLengthCalculator. -
- container - - Object - - An HTMLElement or the window element. -
- isTemporary - - Boolean - - If true, newCalculator will control only the next scroll-animation on the y-axis of this container and it will be automatically discarded at the end of it.
- If false every scroll-animation on the y-axis of this container will be controlled by newCalculator.
- If a container has both a temporary and non-temporary StepLengthCalculator set for its y-axis, the temporary one will controll the next scroll-animation on the y-axis of the container.
- Setting a temporary StepLengthCalculator will only overwrite the previous temporary one.
- Setting a non-temporary StepLengthCalculator will overwrite the previous non-temporary one and discard any temporary one.
-
- setStepLengthCalculator - - newCalculator - - Function - - A valid StepLengthCalculator. -
- container - - Object - - An HTMLElement or the window element. -
- isTemporary - - Boolean - - If true, newCalculator will control only the next scroll-animation on the x-axis and the next one on the y-axis of this container.
- It will automatically be discarded separately for each axis whenever the next scroll-animation on an axis is completed.
- If false every scroll-animation on both the x and y axes of this container will be controlled by newCalculator.
- If a container has both a temporary and non-temporary StepLengthCalculator, the temporary one will controll the next scroll-animation of the container.
- Setting a temporary StepLengthCalculator will only overwrite the previous temporary one.
- Setting a non-temporary StepLengthCalculator will overwrite the previous non-temporary one and discard any temporary one.
-
- setXStepLength - - newXStepLength - - Number - - A number > 0. -
- setYStepLength - - newYStepLength - - Number - - A number > 0. -
- setStepLength - - newStepLength - - Number - - A number > 0. -
- setMinAnimationFrame - - newMinAnimationFrame - - Number - - A number > 0. -
- setPageScroller - - newPageScroller - - Number - - A number > 0. -
- setDebugMode - - newDebugMode - - String - - `legacy`, `disabled` or any other string. -
- calcXStepLength - - deltaX - - Number - - A number > 0. -
- calcYStepLength - - deltaY - - Number - - A number > 0. -
- calcScrollbarsDimensions - - element - - Object - - An HTMLElement or the window element. -
- calcBordersDimensions - - element - - Object - - An HTMLElement or the window element. -
- getScrollXCalculator - - container - - Object - - An HTMLElement or the window element. -
- getScrollYCalculator - - container - - Object - - An HTMLElement or the window element. -
- getMaxScrollX - - container - - Object - - An HTMLElement or the window element. -
- getMaxScrollY - - container - - Object - - An HTMLElement or the window element. -
- getXScrollableParent - - element - - Object - - An HTMLElement or the window element. -
- includeHiddenParents - - Boolean - - True if the first scrollable parent (on the x-axis) of element has the css properties overflow:hidden or overflow-x:hidden, false otherwise. -
- getYScrollableParent - - element - - Object - - An HTMLElement or the window element. -
- includeHiddenParents - - Boolean - - True if the first scrollable parent (on the y-axis) of element has the css properties overflow:hidden or overflow-y:hidden, false otherwise. -
- getScrollableParent - - element - - Object - - An HTMLElement or the window element. -
- includeHiddenParents - - Boolean - - True if the first scrollable parent (on either the x or y axis) of element has the css properties overflow:hidden or overflow-x:hidden or overflow-y:hidden, false otherwise. -
- getAllScrollableParents - - element - - Object - - An HTMLElement or the window element. -
- includeHiddenParents - - Boolean - - True if any of the scrollable parents (on either the x or y axis) of element has the css properties overflow:hidden or overflow-x:hidden or overflow-y:hidden, false otherwise. -
- callback - - Function - - A function which is invoked every time a scrollable parent of element is found.
- When callback is invoked, it is passed (as an input parameter) the scrollable parent found. -
- scrollXTo - - finalXPosition - - Number - - A finite number. -
- container - - Object - - An HTMLElement or the window element. -
- callback - - Function - - A function which is invoked when this scroll-animation is completed. -
- scrollYTo - - finalYPosition - - Number - - A finite number. -
- container - - Object - - An HTMLElement or the window element. -
- callback - - Function - - A function which is invoked when this scroll-animation is completed. -
- scrollXBy - - deltaX - - Number - - A finite number. -
- container - - Object - - An HTMLElement or the window element. -
- callback - - Function - - A function which is invoked when this scroll-animation is completed. -
- stillStart - - Boolean - - True if any on-going scroll-animation on the x-axis of container must be stopped before starting this animation.
- False if any on-going scroll-animation on the x-axis of container should extended by deltaX if possible. -
- scrollYBy - - deltaY - - Number - - A finite number. -
- container - - Object - - An HTMLElement or the window element. -
- callback - - Function - - A function which is invoked when this scroll-animation is completed. -
- stillStart - - Boolean - - True if any on-going scroll-animation on the y-axis of container must be stopped before starting this animation.
- False if any on-going scroll-animation on the y-axis of container should extended by deltaY if possible. -
- scrollTo - - finalXPosition - - Number - - A finite number. -
- finalYPosition - - Number - - A finite number. -
- container - - Object - - An HTMLElement or the window element. -
- callback - - Function - - A function which is invoked when this scroll-animation is completed. -
- scrollBy - - deltaX - - Number - - A finite number. -
- deltaY - - Number - - A finite number. -
- container - - Object - - An HTMLElement or the window element. -
- callback - - Function - - A function which is invoked when this scroll-animation is completed. -
- stillStart - - Boolean - - True if any on-going scroll-animation on either the x and y axes of container must be stopped before starting this animation.
- False if any on-going scroll-animation on either the x and y axes of container should extended by respectively deltaX and deltaY if possible. -
- scrollIntoView - - element - - Object - - An HTMLElement or the window element. -
- alignToLeft - - Object - - True if the alignment (on the x-axis) of element and all its scrollable containers should be to the left.
- False if the alignment (on the x-axis) of element and all its scrollable containers should be to the right.
- "nearest" if the alignment (on the x-axis) of element and all its scrollable containers should be to the to the closest of the other ones described: the alignment of each container is decided by measuring its relative position (on the x-axis) to their closest scrollable parent.
- Any other value if the alignment (on the x-axis) of element and all its scrollable containers should be to the center.
-
- alignToTop - - Object - - True if the alignment (on the y-axis) of element and all its scrollable containers should be to the left.
- False if the alignment (on the y-axis) of element and all its scrollable containers should be to the right.
- "nearest" if the alignment (on the y-axis) of element and all its scrollable containers should be to the to the closest of the other ones described: the alignment of each container is decided by measuring its relative position (on the x-axis) to their closest scrollable parent.
- Any other value if the alignment (on the y-axis) of element and all its scrollable containers should be to the center.
-
- callback - - Function - - A function which is invoked when the passed container is successfully scrolled into view. -
- includeHiddenParents - - Boolean - - True if any of the scrollable parents (on either the x or y axis) of element has the css properties overflow:hidden or overflow-x:hidden or overflow-y:hidden, false otherwise. -
- scrollIntoViewIfNeeded - - element - - Object - - An HTMLElement or the window element. -
- alignToCenter - - Object - - True if the alignment (on either the x and y axis) of element should be to the center of its closest scrollable parent.
- Any other value if the alignment (on either the x and y axis) of element and all its scrollable containers should be to the to the closest between "left aligned" or "right aligned": the alignment of each container is decided by measuring its relative position (on either the x and y axis) to their closest scrollable parent.
-
- callback - - Function - - A function which is invoked when the passed container is successfully scrolled into view. -
- includeHiddenParents - - Boolean - - True if any of the scrollable parents (on either the x or y axis) of element has the css properties overflow:hidden or overflow-x:hidden or overflow-y:hidden, false otherwise. -
- stopScrollingX - - container - - Object - - An HTMLElement or the window element. -
- callback - - Function - - A function which is invoked when the current scroll-animation on the x-axis of the passed container has been stopped. -
- stopScrollingY - - container - - Object - - An HTMLElement or the window element. -
- callback - - Function - - A function which is invoked when the current scroll-animation on the y-axis of the passed container has been stopped. -
- stopScrolling - - container - - Object - - An HTMLElement or the window element. -
- callback - - Function - - A function which is invoked when the current scroll-animations on both the x and y axes of the passed container have been stopped. -
- stopScrollingAll - - callback - - Function - - A function which is invoked when all the current scroll-animations on both the x and y axes of all the containers have been stopped. -
- hrefSetup - - alignToLeft - - Object - - True if the alignment (on the x-axis) of every anchor's destination and all its scrollable containers should be to the left.
- False if the alignment (on the x-axis) of every anchor's destination and all its scrollable containers should be to the right.
- "nearest" if the alignment (on the x-axis) of every anchor's destination and all its scrollable containers should be to the to the closest of the other ones described: the alignment of each container is decided by measuring its relative position (on the x-axis) to their closest scrollable parent.
- Any other value if the alignment (on the x-axis) of every anchor's destination and all its scrollable containers should be to the center.
-
- alignToTop - - Object - - True if the alignment (on the y-axis) of every anchor's destination and all its scrollable containers should be to the left.
- False if the alignment (on the y-axis) of every anchor's destination and all its scrollable containers should be to the right.
- "nearest" if the alignment (on the y-axis) of every anchor's destination and all its scrollable containers should be to the to the closest of the other ones described: the alignment of each container is decided by measuring its relative position (on the x-axis) to their closest scrollable parent.
- Any other value if the alignment (on the y-axis) of every anchor's destination and all its scrollable containers should be to the center.
-
- init - - Function - - A function which is invoked when any anchor is clicked.
- If init returns false, the click is ignored.
- When invoked, init is always passed the following input parameters (in this order): -
    -
  • The anchor that has been clicked.
  • -
  • The anchor's destination element.
  • -
-
- callback - - Function - - A function which is invoked when any anchor's destination element is successfully scrolled into view. -
- includeHiddenParents - - Boolean - - True if any of the scrollable parents (on either the x or y axis) of any anchor's destination has the css properties overflow:hidden or overflow-x:hidden or overflow-y:hidden, false otherwise. -
- updateHistory - - Boolean - - If True, the browser's history is updated every time a valid anchor is clicked and navigating through history triggers a smooth scroll-animation to the corresponding fragment. - If false, the browser's history is never updated by the API and navigating through history produces the default jump-to-position behavior. -
NameParameter NameParameter TypeParameter Description
+ isXscrolling + + container + + Object + + An HTMLElement or the window element. +
+ isYscrolling + + container + + Object + + An HTMLElement or the window element. +
+ isScrolling + + container + + Object + + An HTMLElement or the window element. +
+ getFinalXPosition + + container + + Object + + An HTMLElement or the window element. +
+ getFinalYPosition + + container + + Object + + An HTMLElement or the window element. +
+ getScrollXDirection + + container + + Object + + An HTMLElement or the window element. +
+ getScrollYDirection + + container + + Object + + An HTMLElement or the window element. +
+ getXStepLengthCalculator + + container + + Object + + An HTMLElement or the window element. +
+ getTemporary + + Boolean + + If true the returned StepLengthCalculator is the temporary one set for the x-axis of this + container, otherwise it's the standard one. +
+ getYStepLengthCalculator + + container + + Object + + An HTMLElement or the window element. +
+ getTemporary + + Boolean + + If true the returned StepLengthCalculator is the temporary one set for the y-axis of this + container, otherwise it's the standard one. +
+ setXStepLengthCalculator + + newCalculator + + Function + + A valid StepLengthCalculator. +
+ container + + Object + + An HTMLElement or the window element. +
+ isTemporary + + Boolean + + If true, newCalculator will control only the next scroll-animation on the x-axis of + this container and it will be automatically discarded at the end of it.
+ If false every scroll-animation on the x-axis of this container will be controlled by + newCalculator.
+ If a container has both a temporary and non-temporary StepLengthCalculator set for its x-axis, the temporary one + will controll the next scroll-animation on the x-axis of the container.
+ Setting a temporary StepLengthCalculator will only overwrite the previous temporary one.
+ Setting a non-temporary StepLengthCalculator will overwrite the previous non-temporary one and discard any + temporary one.
+
+ shouldBeTested + + Boolean + + If true, a dummy scroll-animation is performed _(no actual scroll takes place)_ to test the + stepLengthCalculator.
+ Otherwise the new calculator is directly set. +
+ setYStepLengthCalculator + + newCalculator + + Function + + A valid StepLengthCalculator. +
+ container + + Object + + An HTMLElement or the window element. +
+ isTemporary + + Boolean + + If true, newCalculator will control only the next scroll-animation on the y-axis of + this container and it will be automatically discarded at the end of it.
+ If false every scroll-animation on the y-axis of this container will be controlled by + newCalculator.
+ If a container has both a temporary and non-temporary StepLengthCalculator set for its y-axis, the temporary one + will controll the next scroll-animation on the y-axis of the container.
+ Setting a temporary StepLengthCalculator will only overwrite the previous temporary one.
+ Setting a non-temporary StepLengthCalculator will overwrite the previous non-temporary one and discard any + temporary one.
+
+ shouldBeTested + + Boolean + + If true, a dummy scroll-animation is performed _(no actual scroll takes place)_ to test the + stepLengthCalculator.
+ Otherwise the new calculator is directly set. +
+ setStepLengthCalculator + + newCalculator + + Function + + A valid StepLengthCalculator. +
+ container + + Object + + An HTMLElement or the window element. +
+ isTemporary + + Boolean + + If true, newCalculator will control only the next scroll-animation on the x-axis and + the next one on the y-axis of this container.
+ It will automatically be discarded separately for each axis whenever the next scroll-animation on an axis is + completed.
+ If false every scroll-animation on both the x and y axes of this container will be controlled by + newCalculator.
+ If a container has both a temporary and non-temporary StepLengthCalculator, the temporary one will controll the + next scroll-animation of the container.
+ Setting a temporary StepLengthCalculator will only overwrite the previous temporary one.
+ Setting a non-temporary StepLengthCalculator will overwrite the previous non-temporary one and discard any + temporary one.
+
+ shouldBeTested + + Boolean + + If true, a dummy scroll-animation is performed _(no actual scroll takes place)_ to test the + stepLengthCalculator.
+ Otherwise the new calculator is directly set. +
+ setXStepLength + + newXStepLength + + Number + + A number > 0. +
+ setYStepLength + + newYStepLength + + Number + + A number > 0. +
+ setStepLength + + newStepLength + + Number + + A number > 0. +
+ setMinAnimationFrame + + newMinAnimationFrame + + Number + + A number > 0. +
+ setPageScroller + + newPageScroller + + Number + + A number > 0. +
+ setDebugMode + + newDebugMode + + String + + `legacy`, `disabled` or any other string. +
+ calcXStepLength + + deltaX + + Number + + A number > 0. +
+ calcYStepLength + + deltaY + + Number + + A number > 0. +
+ calcScrollbarsDimensions + + element + + Object + + An HTMLElement or the window element. +
+ calcBordersDimensions + + element + + Object + + An HTMLElement or the window element. +
+ getScrollXCalculator + + container + + Object + + An HTMLElement or the window element. +
+ getScrollYCalculator + + container + + Object + + An HTMLElement or the window element. +
+ getMaxScrollX + + container + + Object + + An HTMLElement or the window element. +
+ getMaxScrollY + + container + + Object + + An HTMLElement or the window element. +
+ getXScrollableParent + + element + + Object + + An HTMLElement or the window element. +
+ includeHiddenParents + + Boolean + + True if the first scrollable parent (on the x-axis) of element has the css + properties overflow:hidden or overflow-x:hidden, false otherwise. +
+ getYScrollableParent + + element + + Object + + An HTMLElement or the window element. +
+ includeHiddenParents + + Boolean + + True if the first scrollable parent (on the y-axis) of element has the css + properties overflow:hidden or overflow-y:hidden, false otherwise. +
+ getScrollableParent + + element + + Object + + An HTMLElement or the window element. +
+ includeHiddenParents + + Boolean + + True if the first scrollable parent (on either the x or y axis) of element has + the css properties overflow:hidden or overflow-x:hidden or + overflow-y:hidden, false otherwise. +
+ getAllScrollableParents + + element + + Object + + An HTMLElement or the window element. +
+ includeHiddenParents + + Boolean + + True if any of the scrollable parents (on either the x or y axis) of element + has the css properties overflow:hidden or overflow-x:hidden or + overflow-y:hidden, false otherwise. +
+ callback + + Function + + A function which is invoked every time a scrollable parent of element is found.
+ When callback is invoked, it is passed (as an input parameter) the scrollable parent found. +
+ scrollXTo + + finalXPosition + + Number + + A finite number. +
+ container + + Object + + An HTMLElement or the window element. +
+ callback + + Function + + A function which is invoked when this scroll-animation is completed. +
+ scrollYTo + + finalYPosition + + Number + + A finite number. +
+ container + + Object + + An HTMLElement or the window element. +
+ callback + + Function + + A function which is invoked when this scroll-animation is completed. +
+ scrollXBy + + deltaX + + Number + + A finite number. +
+ container + + Object + + An HTMLElement or the window element. +
+ callback + + Function + + A function which is invoked when this scroll-animation is completed. +
+ stillStart + + Boolean + + True if any on-going scroll-animation on the x-axis of container must be stopped + before starting this animation.
+ False if any on-going scroll-animation on the x-axis of container should extended by + deltaX if possible. +
+ scrollYBy + + deltaY + + Number + + A finite number. +
+ container + + Object + + An HTMLElement or the window element. +
+ callback + + Function + + A function which is invoked when this scroll-animation is completed. +
+ stillStart + + Boolean + + True if any on-going scroll-animation on the y-axis of container must be stopped + before starting this animation.
+ False if any on-going scroll-animation on the y-axis of container should extended by + deltaY if possible. +
+ scrollTo + + finalXPosition + + Number + + A finite number. +
+ finalYPosition + + Number + + A finite number. +
+ container + + Object + + An HTMLElement or the window element. +
+ callback + + Function + + A function which is invoked when this scroll-animation is completed. +
+ scrollBy + + deltaX + + Number + + A finite number. +
+ deltaY + + Number + + A finite number. +
+ container + + Object + + An HTMLElement or the window element. +
+ callback + + Function + + A function which is invoked when this scroll-animation is completed. +
+ stillStart + + Boolean + + True if any on-going scroll-animation on either the x and y axes of container must be + stopped before starting this animation.
+ False if any on-going scroll-animation on either the x and y axes of container should + extended by respectively deltaX and deltaY if possible. +
+ scrollIntoView + + element + + Object + + An HTMLElement or the window element. +
+ alignToLeft + + Object + + True if the alignment (on the x-axis) of element and all its scrollable + containers should be to the left.
+ False if the alignment (on the x-axis) of element and all its scrollable + containers should be to the right.
+ "nearest" if the alignment (on the x-axis) of element and all its scrollable + containers should be to the to the closest of the other ones described: the alignment of each container is + decided by measuring its relative position (on the x-axis) to their closest scrollable parent.
+ Any other value if the alignment (on the x-axis) of element and all its scrollable + containers should be to the center.
+
+ alignToTop + + Object + + True if the alignment (on the y-axis) of element and all its scrollable + containers should be to the left.
+ False if the alignment (on the y-axis) of element and all its scrollable + containers should be to the right.
+ "nearest" if the alignment (on the y-axis) of element and all its scrollable + containers should be to the to the closest of the other ones described: the alignment of each container is + decided by measuring its relative position (on the x-axis) to their closest scrollable parent.
+ Any other value if the alignment (on the y-axis) of element and all its scrollable + containers should be to the center.
+
+ callback + + Function + + A function which is invoked when the passed container is successfully scrolled into view. +
+ includeHiddenParents + + Boolean + + True if any of the scrollable parents (on either the x or y axis) of element + has the css properties overflow:hidden or overflow-x:hidden or + overflow-y:hidden, false otherwise. +
+ scrollIntoViewIfNeeded + + element + + Object + + An HTMLElement or the window element. +
+ alignToCenter + + Object + + True if the alignment (on either the x and y axis) of element should be to the + center of its closest scrollable parent.
+ Any other value if the alignment (on either the x and y axis) of element and all its + scrollable containers should be to the to the closest between "left aligned" or "right aligned": + the alignment of each container is decided by measuring its relative position (on either the x and y + axis) to their closest scrollable parent.
+
+ callback + + Function + + A function which is invoked when the passed container is successfully scrolled into view. +
+ includeHiddenParents + + Boolean + + True if any of the scrollable parents (on either the x or y axis) of element + has the css properties overflow:hidden or overflow-x:hidden or + overflow-y:hidden, false otherwise. +
+ stopScrollingX + + container + + Object + + An HTMLElement or the window element. +
+ callback + + Function + + A function which is invoked when the current scroll-animation on the x-axis of the passed container has been + stopped. +
+ stopScrollingY + + container + + Object + + An HTMLElement or the window element. +
+ callback + + Function + + A function which is invoked when the current scroll-animation on the y-axis of the passed container has been + stopped. +
+ stopScrolling + + container + + Object + + An HTMLElement or the window element. +
+ callback + + Function + + A function which is invoked when the current scroll-animations on both the x and y axes of the passed container + have been stopped. +
+ stopScrollingAll + + callback + + Function + + A function which is invoked when all the current scroll-animations on both the x and y axes of all the + containers have been stopped. +
+ hrefSetup + + alignToLeft + + Object + + True if the alignment (on the x-axis) of every anchor's destination and all its scrollable + containers should be to the left.
+ False if the alignment (on the x-axis) of every anchor's destination and all its scrollable + containers should be to the right.
+ "nearest" if the alignment (on the x-axis) of every anchor's destination and all its + scrollable containers should be to the to the closest of the other ones described: the alignment of each + container is decided by measuring its relative position (on the x-axis) to their closest scrollable + parent.
+ Any other value if the alignment (on the x-axis) of every anchor's destination and all its scrollable + containers should be to the center.
+
+ alignToTop + + Object + + True if the alignment (on the y-axis) of every anchor's destination and all its scrollable + containers should be to the left.
+ False if the alignment (on the y-axis) of every anchor's destination and all its scrollable + containers should be to the right.
+ "nearest" if the alignment (on the y-axis) of every anchor's destination and all its + scrollable containers should be to the to the closest of the other ones described: the alignment of each + container is decided by measuring its relative position (on the x-axis) to their closest scrollable + parent.
+ Any other value if the alignment (on the y-axis) of every anchor's destination and all its scrollable + containers should be to the center.
+
+ init + + Function + + A function which is invoked when any anchor is clicked.
+ If init returns false, the click is ignored.
+ When invoked, init is always passed the following input parameters (in this order): +
    +
  • The anchor that has been clicked.
  • +
  • The anchor's destination element.
  • +
+
+ callback + + Function + + A function which is invoked when any anchor's destination element is successfully scrolled into view. +
+ includeHiddenParents + + Boolean + + True if any of the scrollable parents (on either the x or y axis) of any anchor's + destination has the css properties overflow:hidden or overflow-x:hidden or + overflow-y:hidden, false otherwise. +
+ updateHistory + + Boolean + + If True, the browser's history is updated every time a valid anchor is clicked and navigating + through history triggers a smooth scroll-animation to the corresponding fragment. + If false, the browser's history is never updated by the API and navigating through history produces + the default jump-to-position behavior. +
-
+
-####

Go to next section ⇨

+####

Go to next section ⇨

\ No newline at end of file From 8a562b0d253c41442d09c27a8082e32063f9a38a Mon Sep 17 00:00:00 2001 From: Cristian Davide Conte <64142998+CristianDavideConte@users.noreply.github.com> Date: Tue, 17 May 2022 12:06:59 +0200 Subject: [PATCH 23/26] Update FunctionsAbout.md --- docs/FunctionsAbout.md | 4413 ++++++++++++++++++++-------------------- 1 file changed, 2158 insertions(+), 2255 deletions(-) diff --git a/docs/FunctionsAbout.md b/docs/FunctionsAbout.md index 41342e3..7619b79 100644 --- a/docs/FunctionsAbout.md +++ b/docs/FunctionsAbout.md @@ -1,2276 +1,2179 @@ -#### ⇦ Back to Table of Contents -
+#### ⇦ Back to Table of Contents +
# Available Functions -Once imported, the [`universalsmoothscroll-min.js`](./Download.md) script will automatically declare and initialize _(in -the global scope of your application)_ the `uss` object.
-This object has the below listed properties and they are the core functionalities of the UniversalSmoothScroll API. -
-Each one of these functions can be invoked in this way: `uss.NAME_OF_THE_FUNCTION(param1, param2, ...)`.
+Once imported, the [`universalsmoothscroll-min.js`](./Download.md) script will automatically declare and initialize _(in the global scope of your application)_ the `uss` object.
+This object has the below listed properties and they are the core functionalities of the UniversalSmoothScroll API.
+Each one of these functions can be invoked in this way: `uss.NAME_OF_THE_FUNCTION(param1, param2, ...)`.
For instance: ```javascript /** -* In this example: -* - an ease-out StepLengthCalculator is first set to control -* the scroll-animations on the y-axis of myContainer. -* - the API is requested to scroll the y-axis of myContainer to 500px and -* log "dOnE" when finished. -* - the API is requested to extend the scroll-animation by 50px and -* log "Done" instead of "dOnE" when finished. -*/ + * In this example: + * - an ease-out StepLengthCalculator is first set to control + * the scroll-animations on the y-axis of myContainer. + * - the API is requested to scroll the y-axis of myContainer to 500px and + * log "dOnE" when finished. + * - the API is requested to extend the scroll-animation by 50px and + * log "Done" instead of "dOnE" when finished. + */ uss.setYStepLengthCalculator((r) => {return r / 20 + 1;}, myContainer); -uss.scrollYTo(500, myContainer, () => console.log("dOnE")); -uss.scrollYBy(50, myContainer, () => console.log("Done"), false); +uss.scrollYTo(500, myContainer, () => console.log("dOnE")); +uss.scrollYBy(50, myContainer, () => console.log("Done"), false); ``` -
-
+
+
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameInput ParametersDescription
- isXscrolling - - container - - Returns true if a scroll-animation on the x-axis of the passed container is currently being - performed by this API,false otherwise. -
- isYscrolling - - container - - Returns true if a scroll-animation on the y-axis of the passed container is currently being - performed by this API,false otherwise. -
- isScrolling - - container - - Returns true if a scroll-animation on any axis of the passed container is currently being performed - by this API,false otherwise. -
- getFinalXPosition - - container - - Returns the position (in px) at which the passed container will be at the end of the scroll-animation on - the x-axis.
- The current position is returned if no scroll-animation is in place. -
- getFinalYPosition - - container - - Returns the position (in px) at which the passed container will be at the end of the scroll-animation on - the y-axis.
- The current position is returned if no scroll-animation is in place. -
- getScrollXDirection - - container - - Returns the direction of the current scroll-animation on the x-axis of the passed container: -
    -
  • 1 if its scrollLeft/scrollX will increase.
  • -
  • -1 if its scrollLeft/scrollX will decrease.
  • -
  • 0 if there's no scroll-animation.
  • -
-
- getScrollYDirection - - container - - Returns the direction of the current scroll-animation on the y-axis of the passed container: -
    -
  • 1 if its scrollTop/scrollY will increase.
  • -
  • -1 if its scrollTop/scrollY will decrease.
  • -
  • 0 if there's no scroll-animation.
  • -
-
- getXStepLengthCalculator - - container - - Returns the current StepLengthCalculator - which controls the animations on the x-axis of the passed container if available. -
- getTemporary -
- getYStepLengthCalculator - - container - - Returns the current StepLengthCalculator - which controls the animations on the y-axis of the passed container if available. -
- getTemporary -
- getXStepLength - - / - - Returns the value of the _xStepLength property. -
- getYStepLength - - / - - Returns the value of the _yStepLength property. -
- getMinAnimationFrame - - / - - Returns the value of the _minAnimationFrame property. -
- getWindowHeight - - / - - Returns the value of the _windowHeight property. -
- getWindowWidth - - / - - Returns the value of the _windowWidth property. -
- getScrollbarsMaxDimension - - / - - Returns the value of the _scrollbarsMaxDimension property. -
- getPageScroller - - / - - Returns the value of the _pageScroller property. -
- getReducedMotionState - - / - - Returns the value of the _reducedMotion property. -
- getDebugMode - - / - - Returns the value of the _debugMode property. -
- setXStepLengthCalculator - - newCalculator - - Sets the StepLengthCalculator for (the - x-axis of) the passed container if compatible. -
- container -
- isTemporary -
- shouldBeTested -
- setYStepLengthCalculator - - newCalculator - - Sets the StepLengthCalculator for (the - y-axis of) the passed container if compatible. -
- container -
- isTemporary -
- shouldBeTested -
- setStepLengthCalculator - - newCalculator - - Sets the StepLengthCalculator for (both - the y and x axes of) the passed container if compatible. -
- container -
- isTemporary -
- shouldBeTested -
- setXStepLength - - newXStepLength - - Sets the _xStepLength property to the passed value if compatible. -
- setYStepLength - - newYStepLength - - Sets the _yStepLength property to the passed value if compatible. -
- setStepLength - - newStepLength - - Sets both the _xStepLength and _yStepLength properties to the passed value if - compatible. -
- setMinAnimationFrame - - newMinAnimationFrame - - Sets the _minAnimationFrame property to the passed value if compatible. -
- setPageScroller - - newPageScroller - - Sets the _pageScroller property to the passed value if compatible. -
- setDebugMode - - newDebugMode - - Sets the _debugMode property to the passed value if compatible. -
- calcXStepLength - - deltaX - - Returns how long each animation-step on the x-axis must be in order to target the - _minAnimationFrame property value.
- This function can be considered the default StepLengthCalculator for any - scroll-animation on the x-axis of any container. -
- calcYStepLength - - deltaY - - Returns how long each animation-step on the y-axis must be in order to target the - _minAnimationFrame property value.
- This function can be considered the default StepLengthCalculator for any - scroll-animation on the y-axis of any container. -
- calcScrollbarsDimensions - - element - - Returns an array containing 2 numbers: -
    -
  1. Contains the vertical scrollbar's width (in px) of the passed element.
  2. -
  3. Contains the horizontal scrollbar's height (in px) of the passed element.
  4. -
-
- calcBordersDimensions - - element - - Returns an array containing 4 numbers: -
    -
  1. Contains the top border's height (in px) of the passed element.
  2. -
  3. Contains the right border's width (in px) of the passed element.
  4. -
  5. Contains the bottom border's height (in px) of the passed element.
  6. -
  7. Contains the left border's width (in px) of the passed element.
  8. -
- The returned border sizes don't take into consideration the css "transform" property's effects. -
- getScrollXCalculator - - container - - Returns a function that returns: -
    -
  • The scrollLeft property of the passed container if it's an instance of HTMLElement.
  • -
  • The scrollX property of the passed container if it's the window element.
  • -
-
- getScrollYCalculator - - container - - Returns a function that returns: -
    -
  • The scrollTop property of the passed container if it's an instance of HTMLElement.
  • -
  • The scrollY property of the passed container if it's the window element.
  • -
-
- getMaxScrollX - - container - - Returns the highest reacheable scrollLeft/scrollX value of the passed container. -
- getMaxScrollY - - container - - Returns the highest reacheable scrollTop/scrollY value of the passed container. -
- getXScrollableParent - - element - - Returns the first scrollable container (on the x-axis) of the passed element or null if it doesn't have - one. -
- includeHiddenParents -
- getYScrollableParent - - element - - Returns the first scrollable container (on the y-axis) of the passed element or null if it doesn't have - one. -
- includeHiddenParents -
- getScrollableParent - - element - - Returns the first scrollable container (on either the x or y axis) of the passed element or null if it - doesn't have one. -
- includeHiddenParents -
- getAllScrollableParents - - element - - Returns an array containing all the scrollable containers (on either the x or y axis) of the passed - element. -
- includeHiddenParents -
- callback -
- scrollXTo - - finalXPosition - - Scrolls the x-axis of the passed container to the specified position (in px) if possible. -
- container -
- callback -
- scrollYTo - - finalYPosition - - Scrolls the y-axis of the passed container to the specified position (in px) if possible. -
- container -
- callback -
- scrollXBy - - deltaX - - Scrolls the x-axis the passed container by the specified amount of pixels if possible. -
- container -
- callback -
- stillStart -
- scrollYBy - - deltaY - - Scrolls the y-axis the passed container by the specified amount of pixels if possible. -
- container -
- callback -
- stillStart -
- scrollTo - - finalXPosition - - Scrolls both the x and y axes of the passed container to the specified positions (in px) if possible. -
- finalYPosition -
- container -
- callback -
- scrollBy - - deltaX - - Scrolls both the x and y axes of the passed container by the specified amounts of pixels if possible. -
- deltaY -
- container -
- callback -
- stillStart -
- scrollIntoView - - element - - Scrolls all the scrollable parents of the passed element in order to make it visible on the screen with the - specified alignments. -
- alignToLeft -
- alignToTop -
- callback -
- includeHiddenParents -
- scrollIntoViewIfNeeded - - element - - Scrolls all the scrollable parents of the passed element in order to make it visible on the screen with the - specified alignment only if it's not already visible. -
- alignToCenter -
- callback -
- includeHiddenParents -
- stopScrollingX - - container - - Stops the current scroll-animation on the x-axis of the passed container. -
- callback -
- stopScrollingY - - container - - Stops the current scroll-animation on the y-axis of the passed container. -
- callback -
- stopScrolling - - container - - Stops the current scroll-animations on both the x and y axes of the passed container. -
- callback -
- stopScrollingAll - - callback - - Stops all the current scroll-animations on both the x and y axes of all the containers. -
- hrefSetup - - alignToLeft - - Automatically binds every valid anchor (<a> and <area> in the DOM) to the - corresponding element that should be scrolled into view.
- Whenever a valid anchor is clicked the passed init function is invoked and if it doesn't return - false, a scroll-animation will bring into view the linked element and the browser's history will be - updated (if requested). -
- alignToTop -
- init -
- callback -
- includeHiddenParents -
- updateHistory -
NameInput ParametersDescription
+ isXscrolling + + container + + Returns true if a scroll-animation on the x-axis of the passed container is currently being performed by this API,false otherwise. +
+ isYscrolling + + container + + Returns true if a scroll-animation on the y-axis of the passed container is currently being performed by this API,false otherwise. +
+ isScrolling + + container + + Returns true if a scroll-animation on any axis of the passed container is currently being performed by this API,false otherwise. +
+ getFinalXPosition + + container + + Returns the position (in px) at which the passed container will be at the end of the scroll-animation on the x-axis.
+ The current position is returned if no scroll-animation is in place. +
+ getFinalYPosition + + container + + Returns the position (in px) at which the passed container will be at the end of the scroll-animation on the y-axis.
+ The current position is returned if no scroll-animation is in place. +
+ getScrollXDirection + + container + + Returns the direction of the current scroll-animation on the x-axis of the passed container: +
    +
  • 1 if its scrollLeft/scrollX will increase.
  • +
  • -1 if its scrollLeft/scrollX will decrease.
  • +
  • 0 if there's no scroll-animation.
  • +
+
+ getScrollYDirection + + container + + Returns the direction of the current scroll-animation on the y-axis of the passed container: +
    +
  • 1 if its scrollTop/scrollY will increase.
  • +
  • -1 if its scrollTop/scrollY will decrease.
  • +
  • 0 if there's no scroll-animation.
  • +
+
+ getXStepLengthCalculator + + container + + Returns the current StepLengthCalculator which controls the animations on the x-axis of the passed container if available. +
+ getTemporary +
+ getYStepLengthCalculator + + container + + Returns the current StepLengthCalculator which controls the animations on the y-axis of the passed container if available. +
+ getTemporary +
+ getXStepLength + + / + + Returns the value of the _xStepLength property. +
+ getYStepLength + + / + + Returns the value of the _yStepLength property. +
+ getMinAnimationFrame + + / + + Returns the value of the _minAnimationFrame property. +
+ getWindowHeight + + / + + Returns the value of the _windowHeight property. +
+ getWindowWidth + + / + + Returns the value of the _windowWidth property. +
+ getScrollbarsMaxDimension + + / + + Returns the value of the _scrollbarsMaxDimension property. +
+ getPageScroller + + / + + Returns the value of the _pageScroller property. +
+ getReducedMotionState + + / + + Returns the value of the _reducedMotion property. +
+ getDebugMode + + / + + Returns the value of the _debugMode property. +
+ setXStepLengthCalculator + + newCalculator + + Sets the StepLengthCalculator for (the x-axis of) the passed container if compatible. +
+ container +
+ isTemporary +
+ shouldBeTested +
+ setYStepLengthCalculator + + newCalculator + + Sets the StepLengthCalculator for (the y-axis of) the passed container if compatible. +
+ container +
+ isTemporary +
+ shouldBeTested +
+ setStepLengthCalculator + + newCalculator + + Sets the StepLengthCalculator for (both the y and x axes of) the passed container if compatible. +
+ container +
+ isTemporary +
+ shouldBeTested +
+ setXStepLength + + newXStepLength + + Sets the _xStepLength property to the passed value if compatible. +
+ setYStepLength + + newYStepLength + + Sets the _yStepLength property to the passed value if compatible. +
+ setStepLength + + newStepLength + + Sets both the _xStepLength and _yStepLength properties to the passed value if compatible. +
+ setMinAnimationFrame + + newMinAnimationFrame + + Sets the _minAnimationFrame property to the passed value if compatible. +
+ setPageScroller + + newPageScroller + + Sets the _pageScroller property to the passed value if compatible. +
+ setDebugMode + + newDebugMode + + Sets the _debugMode property to the passed value if compatible. +
+ calcXStepLength + + deltaX + + Returns how long each animation-step on the x-axis must be in order to target the _minAnimationFrame property value.
+ This function can be considered the default StepLengthCalculator for any scroll-animation on the x-axis of any container. +
+ calcYStepLength + + deltaY + + Returns how long each animation-step on the y-axis must be in order to target the _minAnimationFrame property value.
+ This function can be considered the default StepLengthCalculator for any scroll-animation on the y-axis of any container. +
+ calcScrollbarsDimensions + + element + + Returns an array containing 2 numbers: +
    +
  1. Contains the vertical scrollbar's width (in px) of the passed element.
  2. +
  3. Contains the horizontal scrollbar's height (in px) of the passed element.
  4. +
+
+ calcBordersDimensions + + element + + Returns an array containing 4 numbers: +
    +
  1. Contains the top border's height (in px) of the passed element.
  2. +
  3. Contains the right border's width (in px) of the passed element.
  4. +
  5. Contains the bottom border's height (in px) of the passed element.
  6. +
  7. Contains the left border's width (in px) of the passed element.
  8. +
+ The returned border sizes don't take into consideration the css "transform" property's effects. +
+ getScrollXCalculator + + container + + Returns a function that returns: +
    +
  • The scrollLeft property of the passed container if it's an instance of HTMLElement.
  • +
  • The scrollX property of the passed container if it's the window element.
  • +
+
+ getScrollYCalculator + + container + + Returns a function that returns: +
    +
  • The scrollTop property of the passed container if it's an instance of HTMLElement.
  • +
  • The scrollY property of the passed container if it's the window element.
  • +
+
+ getMaxScrollX + + container + + Returns the highest reacheable scrollLeft/scrollX value of the passed container. +
+ getMaxScrollY + + container + + Returns the highest reacheable scrollTop/scrollY value of the passed container. +
+ getXScrollableParent + + element + + Returns the first scrollable container (on the x-axis) of the passed element or null if it doesn't have one. +
+ includeHiddenParents +
+ getYScrollableParent + + element + + Returns the first scrollable container (on the y-axis) of the passed element or null if it doesn't have one. +
+ includeHiddenParents +
+ getScrollableParent + + element + + Returns the first scrollable container (on either the x or y axis) of the passed element or null if it doesn't have one. +
+ includeHiddenParents +
+ getAllScrollableParents + + element + + Returns an array containing all the scrollable containers (on either the x or y axis) of the passed element. +
+ includeHiddenParents +
+ callback +
+ scrollXTo + + finalXPosition + + Scrolls the x-axis of the passed container to the specified position (in px) if possible. +
+ container +
+ callback +
+ scrollYTo + + finalYPosition + + Scrolls the y-axis of the passed container to the specified position (in px) if possible. +
+ container +
+ callback +
+ scrollXBy + + deltaX + + Scrolls the x-axis the passed container by the specified amount of pixels if possible. +
+ container +
+ callback +
+ stillStart +
+ scrollYBy + + deltaY + + Scrolls the y-axis the passed container by the specified amount of pixels if possible. +
+ container +
+ callback +
+ stillStart +
+ scrollTo + + finalXPosition + + Scrolls both the x and y axes of the passed container to the specified positions (in px) if possible. +
+ finalYPosition +
+ container +
+ callback +
+ scrollBy + + deltaX + + Scrolls both the x and y axes of the passed container by the specified amounts of pixels if possible. +
+ deltaY +
+ container +
+ callback +
+ stillStart +
+ scrollIntoView + + element + + Scrolls all the scrollable parents of the passed element in order to make it visible on the screen with the specified alignments. +
+ alignToLeft +
+ alignToTop +
+ callback +
+ includeHiddenParents +
+ scrollIntoViewIfNeeded + + element + + Scrolls all the scrollable parents of the passed element in order to make it visible on the screen with the specified alignment only if it's not already visible. +
+ alignToCenter +
+ callback +
+ includeHiddenParents +
+ stopScrollingX + + container + + Stops the current scroll-animation on the x-axis of the passed container. +
+ callback +
+ stopScrollingY + + container + + Stops the current scroll-animation on the y-axis of the passed container. +
+ callback +
+ stopScrolling + + container + + Stops the current scroll-animations on both the x and y axes of the passed container. +
+ callback +
+ stopScrollingAll + + callback + + Stops all the current scroll-animations on both the x and y axes of all the containers. +
+ hrefSetup + + alignToLeft + + Automatically binds every valid anchor (<a> and <area> in the DOM) to the corresponding element that should be scrolled into view.
+ Whenever a valid anchor is clicked the passed init function is invoked and if it doesn't return false, a scroll-animation will bring into view the linked element and the browser's history will be updated (if requested). +
+ alignToTop +
+ init +
+ callback +
+ includeHiddenParents +
+ updateHistory +
--- -
+
# Input parameters details The following table describes every entry of the `Input Parameters` column of the table above. -
-
+
+
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +
NameParameter NameParameter TypeParameter Description
- isXscrolling - - container - - Object - - An HTMLElement or the window element. -
- isYscrolling - - container - - Object - - An HTMLElement or the window element. -
- isScrolling - - container - - Object - - An HTMLElement or the window element. -
- getFinalXPosition - - container - - Object - - An HTMLElement or the window element. -
- getFinalYPosition - - container - - Object - - An HTMLElement or the window element. -
- getScrollXDirection - - container - - Object - - An HTMLElement or the window element. -
- getScrollYDirection - - container - - Object - - An HTMLElement or the window element. -
- getXStepLengthCalculator - - container - - Object - - An HTMLElement or the window element. -
- getTemporary - - Boolean - - If true the returned StepLengthCalculator is the temporary one set for the x-axis of this - container, otherwise it's the standard one. -
- getYStepLengthCalculator - - container - - Object - - An HTMLElement or the window element. -
- getTemporary - - Boolean - - If true the returned StepLengthCalculator is the temporary one set for the y-axis of this - container, otherwise it's the standard one. -
- setXStepLengthCalculator - - newCalculator - - Function - - A valid StepLengthCalculator. -
- container - - Object - - An HTMLElement or the window element. -
- isTemporary - - Boolean - - If true, newCalculator will control only the next scroll-animation on the x-axis of - this container and it will be automatically discarded at the end of it.
- If false every scroll-animation on the x-axis of this container will be controlled by - newCalculator.
- If a container has both a temporary and non-temporary StepLengthCalculator set for its x-axis, the temporary one - will controll the next scroll-animation on the x-axis of the container.
- Setting a temporary StepLengthCalculator will only overwrite the previous temporary one.
- Setting a non-temporary StepLengthCalculator will overwrite the previous non-temporary one and discard any - temporary one.
-
- shouldBeTested - - Boolean - - If true, a dummy scroll-animation is performed _(no actual scroll takes place)_ to test the - stepLengthCalculator.
- Otherwise the new calculator is directly set. -
- setYStepLengthCalculator - - newCalculator - - Function - - A valid StepLengthCalculator. -
- container - - Object - - An HTMLElement or the window element. -
- isTemporary - - Boolean - - If true, newCalculator will control only the next scroll-animation on the y-axis of - this container and it will be automatically discarded at the end of it.
- If false every scroll-animation on the y-axis of this container will be controlled by - newCalculator.
- If a container has both a temporary and non-temporary StepLengthCalculator set for its y-axis, the temporary one - will controll the next scroll-animation on the y-axis of the container.
- Setting a temporary StepLengthCalculator will only overwrite the previous temporary one.
- Setting a non-temporary StepLengthCalculator will overwrite the previous non-temporary one and discard any - temporary one.
-
- shouldBeTested - - Boolean - - If true, a dummy scroll-animation is performed _(no actual scroll takes place)_ to test the - stepLengthCalculator.
- Otherwise the new calculator is directly set. -
- setStepLengthCalculator - - newCalculator - - Function - - A valid StepLengthCalculator. -
- container - - Object - - An HTMLElement or the window element. -
- isTemporary - - Boolean - - If true, newCalculator will control only the next scroll-animation on the x-axis and - the next one on the y-axis of this container.
- It will automatically be discarded separately for each axis whenever the next scroll-animation on an axis is - completed.
- If false every scroll-animation on both the x and y axes of this container will be controlled by - newCalculator.
- If a container has both a temporary and non-temporary StepLengthCalculator, the temporary one will controll the - next scroll-animation of the container.
- Setting a temporary StepLengthCalculator will only overwrite the previous temporary one.
- Setting a non-temporary StepLengthCalculator will overwrite the previous non-temporary one and discard any - temporary one.
-
- shouldBeTested - - Boolean - - If true, a dummy scroll-animation is performed _(no actual scroll takes place)_ to test the - stepLengthCalculator.
- Otherwise the new calculator is directly set. -
- setXStepLength - - newXStepLength - - Number - - A number > 0. -
- setYStepLength - - newYStepLength - - Number - - A number > 0. -
- setStepLength - - newStepLength - - Number - - A number > 0. -
- setMinAnimationFrame - - newMinAnimationFrame - - Number - - A number > 0. -
- setPageScroller - - newPageScroller - - Number - - A number > 0. -
- setDebugMode - - newDebugMode - - String - - `legacy`, `disabled` or any other string. -
- calcXStepLength - - deltaX - - Number - - A number > 0. -
- calcYStepLength - - deltaY - - Number - - A number > 0. -
- calcScrollbarsDimensions - - element - - Object - - An HTMLElement or the window element. -
- calcBordersDimensions - - element - - Object - - An HTMLElement or the window element. -
- getScrollXCalculator - - container - - Object - - An HTMLElement or the window element. -
- getScrollYCalculator - - container - - Object - - An HTMLElement or the window element. -
- getMaxScrollX - - container - - Object - - An HTMLElement or the window element. -
- getMaxScrollY - - container - - Object - - An HTMLElement or the window element. -
- getXScrollableParent - - element - - Object - - An HTMLElement or the window element. -
- includeHiddenParents - - Boolean - - True if the first scrollable parent (on the x-axis) of element has the css - properties overflow:hidden or overflow-x:hidden, false otherwise. -
- getYScrollableParent - - element - - Object - - An HTMLElement or the window element. -
- includeHiddenParents - - Boolean - - True if the first scrollable parent (on the y-axis) of element has the css - properties overflow:hidden or overflow-y:hidden, false otherwise. -
- getScrollableParent - - element - - Object - - An HTMLElement or the window element. -
- includeHiddenParents - - Boolean - - True if the first scrollable parent (on either the x or y axis) of element has - the css properties overflow:hidden or overflow-x:hidden or - overflow-y:hidden, false otherwise. -
- getAllScrollableParents - - element - - Object - - An HTMLElement or the window element. -
- includeHiddenParents - - Boolean - - True if any of the scrollable parents (on either the x or y axis) of element - has the css properties overflow:hidden or overflow-x:hidden or - overflow-y:hidden, false otherwise. -
- callback - - Function - - A function which is invoked every time a scrollable parent of element is found.
- When callback is invoked, it is passed (as an input parameter) the scrollable parent found. -
- scrollXTo - - finalXPosition - - Number - - A finite number. -
- container - - Object - - An HTMLElement or the window element. -
- callback - - Function - - A function which is invoked when this scroll-animation is completed. -
- scrollYTo - - finalYPosition - - Number - - A finite number. -
- container - - Object - - An HTMLElement or the window element. -
- callback - - Function - - A function which is invoked when this scroll-animation is completed. -
- scrollXBy - - deltaX - - Number - - A finite number. -
- container - - Object - - An HTMLElement or the window element. -
- callback - - Function - - A function which is invoked when this scroll-animation is completed. -
- stillStart - - Boolean - - True if any on-going scroll-animation on the x-axis of container must be stopped - before starting this animation.
- False if any on-going scroll-animation on the x-axis of container should extended by - deltaX if possible. -
- scrollYBy - - deltaY - - Number - - A finite number. -
- container - - Object - - An HTMLElement or the window element. -
- callback - - Function - - A function which is invoked when this scroll-animation is completed. -
- stillStart - - Boolean - - True if any on-going scroll-animation on the y-axis of container must be stopped - before starting this animation.
- False if any on-going scroll-animation on the y-axis of container should extended by - deltaY if possible. -
- scrollTo - - finalXPosition - - Number - - A finite number. -
- finalYPosition - - Number - - A finite number. -
- container - - Object - - An HTMLElement or the window element. -
- callback - - Function - - A function which is invoked when this scroll-animation is completed. -
- scrollBy - - deltaX - - Number - - A finite number. -
- deltaY - - Number - - A finite number. -
- container - - Object - - An HTMLElement or the window element. -
- callback - - Function - - A function which is invoked when this scroll-animation is completed. -
- stillStart - - Boolean - - True if any on-going scroll-animation on either the x and y axes of container must be - stopped before starting this animation.
- False if any on-going scroll-animation on either the x and y axes of container should - extended by respectively deltaX and deltaY if possible. -
- scrollIntoView - - element - - Object - - An HTMLElement or the window element. -
- alignToLeft - - Object - - True if the alignment (on the x-axis) of element and all its scrollable - containers should be to the left.
- False if the alignment (on the x-axis) of element and all its scrollable - containers should be to the right.
- "nearest" if the alignment (on the x-axis) of element and all its scrollable - containers should be to the to the closest of the other ones described: the alignment of each container is - decided by measuring its relative position (on the x-axis) to their closest scrollable parent.
- Any other value if the alignment (on the x-axis) of element and all its scrollable - containers should be to the center.
-
- alignToTop - - Object - - True if the alignment (on the y-axis) of element and all its scrollable - containers should be to the left.
- False if the alignment (on the y-axis) of element and all its scrollable - containers should be to the right.
- "nearest" if the alignment (on the y-axis) of element and all its scrollable - containers should be to the to the closest of the other ones described: the alignment of each container is - decided by measuring its relative position (on the x-axis) to their closest scrollable parent.
- Any other value if the alignment (on the y-axis) of element and all its scrollable - containers should be to the center.
-
- callback - - Function - - A function which is invoked when the passed container is successfully scrolled into view. -
- includeHiddenParents - - Boolean - - True if any of the scrollable parents (on either the x or y axis) of element - has the css properties overflow:hidden or overflow-x:hidden or - overflow-y:hidden, false otherwise. -
- scrollIntoViewIfNeeded - - element - - Object - - An HTMLElement or the window element. -
- alignToCenter - - Object - - True if the alignment (on either the x and y axis) of element should be to the - center of its closest scrollable parent.
- Any other value if the alignment (on either the x and y axis) of element and all its - scrollable containers should be to the to the closest between "left aligned" or "right aligned": - the alignment of each container is decided by measuring its relative position (on either the x and y - axis) to their closest scrollable parent.
-
- callback - - Function - - A function which is invoked when the passed container is successfully scrolled into view. -
- includeHiddenParents - - Boolean - - True if any of the scrollable parents (on either the x or y axis) of element - has the css properties overflow:hidden or overflow-x:hidden or - overflow-y:hidden, false otherwise. -
- stopScrollingX - - container - - Object - - An HTMLElement or the window element. -
- callback - - Function - - A function which is invoked when the current scroll-animation on the x-axis of the passed container has been - stopped. -
- stopScrollingY - - container - - Object - - An HTMLElement or the window element. -
- callback - - Function - - A function which is invoked when the current scroll-animation on the y-axis of the passed container has been - stopped. -
- stopScrolling - - container - - Object - - An HTMLElement or the window element. -
- callback - - Function - - A function which is invoked when the current scroll-animations on both the x and y axes of the passed container - have been stopped. -
- stopScrollingAll - - callback - - Function - - A function which is invoked when all the current scroll-animations on both the x and y axes of all the - containers have been stopped. -
- hrefSetup - - alignToLeft - - Object - - True if the alignment (on the x-axis) of every anchor's destination and all its scrollable - containers should be to the left.
- False if the alignment (on the x-axis) of every anchor's destination and all its scrollable - containers should be to the right.
- "nearest" if the alignment (on the x-axis) of every anchor's destination and all its - scrollable containers should be to the to the closest of the other ones described: the alignment of each - container is decided by measuring its relative position (on the x-axis) to their closest scrollable - parent.
- Any other value if the alignment (on the x-axis) of every anchor's destination and all its scrollable - containers should be to the center.
-
- alignToTop - - Object - - True if the alignment (on the y-axis) of every anchor's destination and all its scrollable - containers should be to the left.
- False if the alignment (on the y-axis) of every anchor's destination and all its scrollable - containers should be to the right.
- "nearest" if the alignment (on the y-axis) of every anchor's destination and all its - scrollable containers should be to the to the closest of the other ones described: the alignment of each - container is decided by measuring its relative position (on the x-axis) to their closest scrollable - parent.
- Any other value if the alignment (on the y-axis) of every anchor's destination and all its scrollable - containers should be to the center.
-
- init - - Function - - A function which is invoked when any anchor is clicked.
- If init returns false, the click is ignored.
- When invoked, init is always passed the following input parameters (in this order): -
    -
  • The anchor that has been clicked.
  • -
  • The anchor's destination element.
  • -
-
- callback - - Function - - A function which is invoked when any anchor's destination element is successfully scrolled into view. -
- includeHiddenParents - - Boolean - - True if any of the scrollable parents (on either the x or y axis) of any anchor's - destination has the css properties overflow:hidden or overflow-x:hidden or - overflow-y:hidden, false otherwise. -
- updateHistory - - Boolean - - If True, the browser's history is updated every time a valid anchor is clicked and navigating - through history triggers a smooth scroll-animation to the corresponding fragment. - If false, the browser's history is never updated by the API and navigating through history produces - the default jump-to-position behavior. -
NameParameter NameParameter TypeParameter Description
+ isXscrolling + + container + + Object + + An HTMLElement or the window element. +
+ isYscrolling + + container + + Object + + An HTMLElement or the window element. +
+ isScrolling + + container + + Object + + An HTMLElement or the window element. +
+ getFinalXPosition + + container + + Object + + An HTMLElement or the window element. +
+ getFinalYPosition + + container + + Object + + An HTMLElement or the window element. +
+ getScrollXDirection + + container + + Object + + An HTMLElement or the window element. +
+ getScrollYDirection + + container + + Object + + An HTMLElement or the window element. +
+ getXStepLengthCalculator + + container + + Object + + An HTMLElement or the window element. +
+ getTemporary + + Boolean + + If true the returned StepLengthCalculator is the temporary one set for the x-axis of this container, otherwise it's the standard one. +
+ getYStepLengthCalculator + + container + + Object + + An HTMLElement or the window element. +
+ getTemporary + + Boolean + + If true the returned StepLengthCalculator is the temporary one set for the y-axis of this container, otherwise it's the standard one. +
+ setXStepLengthCalculator + + newCalculator + + Function + + A valid StepLengthCalculator. +
+ container + + Object + + An HTMLElement or the window element. +
+ isTemporary + + Boolean + + If true, newCalculator will control only the next scroll-animation on the x-axis of this container and it will be automatically discarded at the end of it.
+ If false every scroll-animation on the x-axis of this container will be controlled by newCalculator.
+ If a container has both a temporary and non-temporary StepLengthCalculator set for its x-axis, the temporary one will controll the next scroll-animation on the x-axis of the container.
+ Setting a temporary StepLengthCalculator will only overwrite the previous temporary one.
+ Setting a non-temporary StepLengthCalculator will overwrite the previous non-temporary one and discard any temporary one.
+
+ shouldBeTested + + Boolean + + If true, a dummy scroll-animation is performed _(no actual scroll takes place)_ to test the stepLengthCalculator.
+ Otherwise the new calculator is directly set. +
+ setYStepLengthCalculator + + newCalculator + + Function + + A valid StepLengthCalculator. +
+ container + + Object + + An HTMLElement or the window element. +
+ isTemporary + + Boolean + + If true, newCalculator will control only the next scroll-animation on the y-axis of this container and it will be automatically discarded at the end of it.
+ If false every scroll-animation on the y-axis of this container will be controlled by newCalculator.
+ If a container has both a temporary and non-temporary StepLengthCalculator set for its y-axis, the temporary one will controll the next scroll-animation on the y-axis of the container.
+ Setting a temporary StepLengthCalculator will only overwrite the previous temporary one.
+ Setting a non-temporary StepLengthCalculator will overwrite the previous non-temporary one and discard any temporary one.
+
+ shouldBeTested + + Boolean + + If true, a dummy scroll-animation is performed _(no actual scroll takes place)_ to test the stepLengthCalculator.
+ Otherwise the new calculator is directly set. +
+ setStepLengthCalculator + + newCalculator + + Function + + A valid StepLengthCalculator. +
+ container + + Object + + An HTMLElement or the window element. +
+ isTemporary + + Boolean + + If true, newCalculator will control only the next scroll-animation on the x-axis and the next one on the y-axis of this container.
+ It will automatically be discarded separately for each axis whenever the next scroll-animation on an axis is completed.
+ If false every scroll-animation on both the x and y axes of this container will be controlled by newCalculator.
+ If a container has both a temporary and non-temporary StepLengthCalculator, the temporary one will controll the next scroll-animation of the container.
+ Setting a temporary StepLengthCalculator will only overwrite the previous temporary one.
+ Setting a non-temporary StepLengthCalculator will overwrite the previous non-temporary one and discard any temporary one.
+
+ shouldBeTested + + Boolean + + If true, a dummy scroll-animation is performed _(no actual scroll takes place)_ to test the stepLengthCalculator.
+ Otherwise the new calculator is directly set. +
+ setXStepLength + + newXStepLength + + Number + + A number > 0. +
+ setYStepLength + + newYStepLength + + Number + + A number > 0. +
+ setStepLength + + newStepLength + + Number + + A number > 0. +
+ setMinAnimationFrame + + newMinAnimationFrame + + Number + + A number > 0. +
+ setPageScroller + + newPageScroller + + Number + + A number > 0. +
+ setDebugMode + + newDebugMode + + String + + `legacy`, `disabled` or any other string. +
+ calcXStepLength + + deltaX + + Number + + A number > 0. +
+ calcYStepLength + + deltaY + + Number + + A number > 0. +
+ calcScrollbarsDimensions + + element + + Object + + An HTMLElement or the window element. +
+ calcBordersDimensions + + element + + Object + + An HTMLElement or the window element. +
+ getScrollXCalculator + + container + + Object + + An HTMLElement or the window element. +
+ getScrollYCalculator + + container + + Object + + An HTMLElement or the window element. +
+ getMaxScrollX + + container + + Object + + An HTMLElement or the window element. +
+ getMaxScrollY + + container + + Object + + An HTMLElement or the window element. +
+ getXScrollableParent + + element + + Object + + An HTMLElement or the window element. +
+ includeHiddenParents + + Boolean + + True if the first scrollable parent (on the x-axis) of element has the css properties overflow:hidden or overflow-x:hidden, false otherwise. +
+ getYScrollableParent + + element + + Object + + An HTMLElement or the window element. +
+ includeHiddenParents + + Boolean + + True if the first scrollable parent (on the y-axis) of element has the css properties overflow:hidden or overflow-y:hidden, false otherwise. +
+ getScrollableParent + + element + + Object + + An HTMLElement or the window element. +
+ includeHiddenParents + + Boolean + + True if the first scrollable parent (on either the x or y axis) of element has the css properties overflow:hidden or overflow-x:hidden or overflow-y:hidden, false otherwise. +
+ getAllScrollableParents + + element + + Object + + An HTMLElement or the window element. +
+ includeHiddenParents + + Boolean + + True if any of the scrollable parents (on either the x or y axis) of element has the css properties overflow:hidden or overflow-x:hidden or overflow-y:hidden, false otherwise. +
+ callback + + Function + + A function which is invoked every time a scrollable parent of element is found.
+ When callback is invoked, it is passed (as an input parameter) the scrollable parent found. +
+ scrollXTo + + finalXPosition + + Number + + A finite number. +
+ container + + Object + + An HTMLElement or the window element. +
+ callback + + Function + + A function which is invoked when this scroll-animation is completed. +
+ scrollYTo + + finalYPosition + + Number + + A finite number. +
+ container + + Object + + An HTMLElement or the window element. +
+ callback + + Function + + A function which is invoked when this scroll-animation is completed. +
+ scrollXBy + + deltaX + + Number + + A finite number. +
+ container + + Object + + An HTMLElement or the window element. +
+ callback + + Function + + A function which is invoked when this scroll-animation is completed. +
+ stillStart + + Boolean + + True if any on-going scroll-animation on the x-axis of container must be stopped before starting this animation.
+ False if any on-going scroll-animation on the x-axis of container should extended by deltaX if possible. +
+ scrollYBy + + deltaY + + Number + + A finite number. +
+ container + + Object + + An HTMLElement or the window element. +
+ callback + + Function + + A function which is invoked when this scroll-animation is completed. +
+ stillStart + + Boolean + + True if any on-going scroll-animation on the y-axis of container must be stopped before starting this animation.
+ False if any on-going scroll-animation on the y-axis of container should extended by deltaY if possible. +
+ scrollTo + + finalXPosition + + Number + + A finite number. +
+ finalYPosition + + Number + + A finite number. +
+ container + + Object + + An HTMLElement or the window element. +
+ callback + + Function + + A function which is invoked when this scroll-animation is completed. +
+ scrollBy + + deltaX + + Number + + A finite number. +
+ deltaY + + Number + + A finite number. +
+ container + + Object + + An HTMLElement or the window element. +
+ callback + + Function + + A function which is invoked when this scroll-animation is completed. +
+ stillStart + + Boolean + + True if any on-going scroll-animation on either the x and y axes of container must be stopped before starting this animation.
+ False if any on-going scroll-animation on either the x and y axes of container should extended by respectively deltaX and deltaY if possible. +
+ scrollIntoView + + element + + Object + + An HTMLElement or the window element. +
+ alignToLeft + + Object + + True if the alignment (on the x-axis) of element and all its scrollable containers should be to the left.
+ False if the alignment (on the x-axis) of element and all its scrollable containers should be to the right.
+ "nearest" if the alignment (on the x-axis) of element and all its scrollable containers should be to the to the closest of the other ones described: the alignment of each container is decided by measuring its relative position (on the x-axis) to their closest scrollable parent.
+ Any other value if the alignment (on the x-axis) of element and all its scrollable containers should be to the center.
+
+ alignToTop + + Object + + True if the alignment (on the y-axis) of element and all its scrollable containers should be to the left.
+ False if the alignment (on the y-axis) of element and all its scrollable containers should be to the right.
+ "nearest" if the alignment (on the y-axis) of element and all its scrollable containers should be to the to the closest of the other ones described: the alignment of each container is decided by measuring its relative position (on the x-axis) to their closest scrollable parent.
+ Any other value if the alignment (on the y-axis) of element and all its scrollable containers should be to the center.
+
+ callback + + Function + + A function which is invoked when the passed container is successfully scrolled into view. +
+ includeHiddenParents + + Boolean + + True if any of the scrollable parents (on either the x or y axis) of element has the css properties overflow:hidden or overflow-x:hidden or overflow-y:hidden, false otherwise. +
+ scrollIntoViewIfNeeded + + element + + Object + + An HTMLElement or the window element. +
+ alignToCenter + + Object + + True if the alignment (on either the x and y axis) of element should be to the center of its closest scrollable parent.
+ Any other value if the alignment (on either the x and y axis) of element and all its scrollable containers should be to the to the closest between "left aligned" or "right aligned": the alignment of each container is decided by measuring its relative position (on either the x and y axis) to their closest scrollable parent.
+
+ callback + + Function + + A function which is invoked when the passed container is successfully scrolled into view. +
+ includeHiddenParents + + Boolean + + True if any of the scrollable parents (on either the x or y axis) of element has the css properties overflow:hidden or overflow-x:hidden or overflow-y:hidden, false otherwise. +
+ stopScrollingX + + container + + Object + + An HTMLElement or the window element. +
+ callback + + Function + + A function which is invoked when the current scroll-animation on the x-axis of the passed container has been stopped. +
+ stopScrollingY + + container + + Object + + An HTMLElement or the window element. +
+ callback + + Function + + A function which is invoked when the current scroll-animation on the y-axis of the passed container has been stopped. +
+ stopScrolling + + container + + Object + + An HTMLElement or the window element. +
+ callback + + Function + + A function which is invoked when the current scroll-animations on both the x and y axes of the passed container have been stopped. +
+ stopScrollingAll + + callback + + Function + + A function which is invoked when all the current scroll-animations on both the x and y axes of all the containers have been stopped. +
+ hrefSetup + + alignToLeft + + Object + + True if the alignment (on the x-axis) of every anchor's destination and all its scrollable containers should be to the left.
+ False if the alignment (on the x-axis) of every anchor's destination and all its scrollable containers should be to the right.
+ "nearest" if the alignment (on the x-axis) of every anchor's destination and all its scrollable containers should be to the to the closest of the other ones described: the alignment of each container is decided by measuring its relative position (on the x-axis) to their closest scrollable parent.
+ Any other value if the alignment (on the x-axis) of every anchor's destination and all its scrollable containers should be to the center.
+
+ alignToTop + + Object + + True if the alignment (on the y-axis) of every anchor's destination and all its scrollable containers should be to the left.
+ False if the alignment (on the y-axis) of every anchor's destination and all its scrollable containers should be to the right.
+ "nearest" if the alignment (on the y-axis) of every anchor's destination and all its scrollable containers should be to the to the closest of the other ones described: the alignment of each container is decided by measuring its relative position (on the x-axis) to their closest scrollable parent.
+ Any other value if the alignment (on the y-axis) of every anchor's destination and all its scrollable containers should be to the center.
+
+ init + + Function + + A function which is invoked when any anchor is clicked.
+ If init returns false, the click is ignored.
+ When invoked, init is always passed the following input parameters (in this order): +
    +
  • The anchor that has been clicked.
  • +
  • The anchor's destination element.
  • +
+
+ callback + + Function + + A function which is invoked when any anchor's destination element is successfully scrolled into view. +
+ includeHiddenParents + + Boolean + + True if any of the scrollable parents (on either the x or y axis) of any anchor's destination has the css properties overflow:hidden or overflow-x:hidden or overflow-y:hidden, false otherwise. +
+ updateHistory + + Boolean + + If True, the browser's history is updated every time a valid anchor is clicked and navigating through history triggers a smooth scroll-animation to the corresponding fragment. + If false, the browser's history is never updated by the API and navigating through history produces the default jump-to-position behavior. +
-
+
-####

Go to next section ⇨

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

Go to next section ⇨

From a5694aad31f583a0edf9f7609396502a45647202 Mon Sep 17 00:00:00 2001 From: Cristian Davide Conte <64142998+CristianDavideConte@users.noreply.github.com> Date: Tue, 17 May 2022 12:08:48 +0200 Subject: [PATCH 24/26] Update FunctionsAbout.md --- docs/FunctionsAbout.md | 67 +++++------------------------------------- 1 file changed, 8 insertions(+), 59 deletions(-) diff --git a/docs/FunctionsAbout.md b/docs/FunctionsAbout.md index 7619b79..1631c49 100644 --- a/docs/FunctionsAbout.md +++ b/docs/FunctionsAbout.md @@ -272,7 +272,7 @@ uss.scrollYBy(50, myContainer, () => console.log("Done"), false); - + setXStepLengthCalculator @@ -292,14 +292,9 @@ uss.scrollYBy(50, myContainer, () => console.log("Done"), false); isTemporary - - - shouldBeTested - - - + setYStepLengthCalculator @@ -319,14 +314,9 @@ uss.scrollYBy(50, myContainer, () => console.log("Done"), false); isTemporary - - - shouldBeTested - - - + setStepLengthCalculator @@ -346,11 +336,6 @@ uss.scrollYBy(50, myContainer, () => console.log("Done"), false); isTemporary - - - shouldBeTested - - @@ -1110,7 +1095,7 @@ The following table describes every entry of the `Input Parameters` column of th - + setXStepLengthCalculator @@ -1149,21 +1134,9 @@ The following table describes every entry of the `Input Parameters` column of th Setting a non-temporary StepLengthCalculator will overwrite the previous non-temporary one and discard any temporary one.
- - - shouldBeTested - - - Boolean - - - If true, a dummy scroll-animation is performed _(no actual scroll takes place)_ to test the stepLengthCalculator.
- Otherwise the new calculator is directly set. - - - + setYStepLengthCalculator @@ -1202,21 +1175,9 @@ The following table describes every entry of the `Input Parameters` column of th Setting a non-temporary StepLengthCalculator will overwrite the previous non-temporary one and discard any temporary one.
- - - shouldBeTested - - - Boolean - - - If true, a dummy scroll-animation is performed _(no actual scroll takes place)_ to test the stepLengthCalculator.
- Otherwise the new calculator is directly set. - - - + setStepLengthCalculator @@ -1256,19 +1217,7 @@ The following table describes every entry of the `Input Parameters` column of th Setting a non-temporary StepLengthCalculator will overwrite the previous non-temporary one and discard any temporary one.
- - - shouldBeTested - - - Boolean - - - If true, a dummy scroll-animation is performed _(no actual scroll takes place)_ to test the stepLengthCalculator.
- Otherwise the new calculator is directly set. - - - + setXStepLength @@ -2151,7 +2100,7 @@ The following table describes every entry of the `Input Parameters` column of th includeHiddenParents - + Boolean From e136cc9996c0ecd1458a7e3a0bfe55491c269a04 Mon Sep 17 00:00:00 2001 From: Cristian Davide Conte <64142998+CristianDavideConte@users.noreply.github.com> Date: Tue, 17 May 2022 15:57:17 +0200 Subject: [PATCH 25/26] Update uss_ubuntu_tests.yml --- .github/workflows/uss_ubuntu_tests.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/uss_ubuntu_tests.yml b/.github/workflows/uss_ubuntu_tests.yml index b3a4a7a..d3b2168 100644 --- a/.github/workflows/uss_ubuntu_tests.yml +++ b/.github/workflows/uss_ubuntu_tests.yml @@ -4,9 +4,7 @@ name: uss-tests-ubuntu on: # Triggers the workflow on push or pull request events for beta and master branches push: - branches: [ master, beta ] pull_request: - branches: [ master, beta ] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: From 425b0c47b24e449165ab8a57f10f56a7d6e0ec3c Mon Sep 17 00:00:00 2001 From: Cristian Davide Conte <64142998+CristianDavideConte@users.noreply.github.com> Date: Tue, 17 May 2022 16:02:42 +0200 Subject: [PATCH 26/26] Update uss_windows_tests.yml --- .github/workflows/uss_windows_tests.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/uss_windows_tests.yml b/.github/workflows/uss_windows_tests.yml index 20a748a..561b687 100644 --- a/.github/workflows/uss_windows_tests.yml +++ b/.github/workflows/uss_windows_tests.yml @@ -4,9 +4,7 @@ name: uss-tests-windows on: # Triggers the workflow on push or pull request events for beta and master branches push: - branches: [ master, beta ] pull_request: - branches: [ master, beta ] # Allows you to run this workflow manually from the Actions tab workflow_dispatch: