Coder Social home page Coder Social logo

svelte-waypoint's Introduction

svelte-waypoint

Lazyload images or anything in Svelte and Sapper.

Install

yarn add svelte-waypoint

or

npm install svelte-waypoint --save

Lazyload your stuff!

<script>
  import Waypoint from 'svelte-waypoint';
</script>

/*
  This will check if element is visible every 500ms and will fire
  200 pixels above the element's top border. 
*/
<Waypoint throttle="500" offset="200">
  <MyComponent />
</Waypoint>

Options

  • throttle (default: 250) Interval in milliseconds at which listener function is fired.
  • offset Distance from the top of the element in pixels at which the element will be marked visible.
  • class (or c, deprecated) Classes passed down to waypoint's wrapper (should be unnecessary once components may receive classes)
  • style Same as above but for style prop.
  • once (default: true) If false, component will disappear every time it leaves the viewport.
  • threshold (default: 0) "A threshold of 1.0 means that when 100% of the target is visible within the element specified by the root option, the callback is invoked."
  • disabled (default: false) Disable lazyloading. Currently works only in IE11+.

Events

  • on:enter Callback when component enters the viewport.
  • on:leave Callback when component leaves the viewport.

svelte-waypoint's People

Contributors

dependabot[bot] avatar jakubsacha avatar matyunya avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

svelte-waypoint's Issues

Invalid SSR Component

For a brief second after installing the package and following the instructions, I get a 500 error and message stating that Waypoint is an invalid SSR component. I was hoping this could be the solution for lazy loading images as it seems the other package does not work well with a node-sass setup in sapper.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.