1.2.9 • Published 4 months ago

nuxt-lenis v1.2.9

Weekly downloads
-
License
MIT
Repository
github
Last release
4 months ago

Nuxt Lenis

This is a Nuxt wrapper for Lenis by Studio Freight. Thank them for the incredible tool.

Please Note

Because of how Vue/Nuxt useState works, we have to recreate the ScrollState to a new object. We are porting over all fields we find necessary as you can also grab Lenis for all methods and attributes.

Getting Started

  1. yarn add nuxt-lenis
  2. Add nuxt-lenis to your modules in nuxt.config
  3. In your app.vue file, wrap the nuxt page in the lenis component
       <lenis
          :options="LenisOptions"
          @initiated="foo"
          @scroll="fooBar"
       >
          <NuxtPage />
       </lenis>

Composable

   <!-- You can pass in true or false into useLenis if you want to use more than one lenis instance. Defaults to single instance (true) -->
   const {scrollState, lenis} = useLenis()

   watch(scrollState, (val) => {
      console.log("scrollState", val);
   },{deep:true});

Multiple Instances

If you have multiple instances of Lenis you can get each one via an ID set ont he Lenis component

   <lenis id="base" >
      <NuxtPage />
   </lenis>
   
   <lenis id="modal" >
      <NuxtPage />
   </lenis>

   <!-- script -->
   const {scrollState, lenis} = useLenis(false)

   scrollState.value.base
   lenis.base
   scrollState.value.modal
   lenis.modal
2.0.3

5 months ago

2.0.2

5 months ago

2.0.5

5 months ago

2.0.4

5 months ago

2.0.7

4 months ago

2.0.6

4 months ago

2.0.9

4 months ago

2.0.8

4 months ago

2.0.1

5 months ago

1.2.8

10 months ago

1.2.7

10 months ago

1.2.6

10 months ago

1.2.5

10 months ago

1.2.9

10 months ago

1.2.0

1 year ago

1.1.6

1 year ago

1.2.4

11 months ago

1.1.5

1 year ago

1.2.3

12 months ago

1.1.4

1 year ago

1.2.2

1 year ago

1.1.3

1 year ago

1.2.1

1 year ago

1.1.2

1 year ago

1.1.0

1 year ago

1.1.0-beta.11

1 year ago

1.1.0-beta.14

1 year ago

1.1.0-beta.12

1 year ago

1.1.0-beta.13

1 year ago

1.1.0-beta.10

1 year ago

1.1.0-beta.9

1 year ago

1.1.0-beta.7

1 year ago

1.1.0-beta.6

1 year ago

1.1.0-beta.5

1 year ago

1.1.0-beta.2

1 year ago

1.1.0-beta.1

1 year ago

1.1.0-beta.4

1 year ago

1.1.0-beta.3

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

2 years ago

1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago