Skip to content

razshare/svelte-liquid-swipe

Folders and files

NameName
Last commit message
Last commit date

Latest commit

5fd5acb · Jun 10, 2024

History

48 Commits
Jun 10, 2024
Apr 2, 2023
Apr 1, 2023
Apr 2, 2023
Apr 1, 2023
Apr 1, 2023
Apr 1, 2023
Apr 2, 2023
Apr 2, 2023
May 26, 2024
Jun 25, 2023
Jun 10, 2024
Jun 25, 2023
Apr 2, 2023
Apr 2, 2023
Apr 2, 2023

Repository files navigation

Usage

Install with

npm i -D svelte-liquid-swipe

Import your LiquidContainer component

<script>
  import { LiquidContainer } from 'svelte-liquid-swipe'
</script>

<LiquidContainer />

The LiquidContainer component exposes a root element of position:absolute, meaning you'll have to wrap it inside your own relative, fixed, etc element in order to manage its size and position.

Something like this

<script>
  import { LiquidContainer } from 'svelte-liquid-swipe'
</script>

<div style="position:relative;width:600px;height:800px;overflow:hidden">
  <LiquidContainer />
</div>

Then add some components to your container

<script>
  import { LiquidContainer } from 'svelte-liquid-swipe'
  import Page1 from 'page1.svelte'
  import Page2 from 'page2.svelte'
  import Page3 from 'page3.svelte'
  import Page4 from 'page4.svelte'

  const pages = [Page1, Page2, Page3, Page4]
</script>

<div style="position:relative;width:600px;height:800px;overflow:hidden">
  <LiquidContainer direction="right" components="{pages}" />
</div>

Result

Make sure you set overflow:hidden on your wrapper for the best results.

Notes

Looking for full project example? Checkout the example branch.