npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

vue-html-slider

v1.3.3

Published

A simple, light and configurable vue silder component.

Downloads

47

Readme

vue-html-slider

npm downloads license

A simple, light and configurable vue silder component.

Install

use npm

npm install vue-html-slider

use yarn

yarn add vue-html-slider

Get Started

Just one property is required to start the slider as follows.

<!--vue template-->
<template> 
  <vue-html-slider :data="images"></vue-html-slider>
</template>
<script>
  import vueHtmlSlider from 'vue-html-slider';
  export default {
    components: {
      'vue-html-slider': vueHtmlSlider
    },
    data() {
      return {
        images: [
          'http://path/to/a.png',
          'http://path/to/b.png'
        ]
      }
    }
  }
</script>

With just a few steps, you can create a slider application. As well, there is an online demo which provides a real experience for you.

avatar

Advanced

Slider defines many properties for customizing what you want. You can set the options property to slider as follow.

<template> 
  <vue-html-slider :options="options"></vue-html-slider>
</template>
<script>
  // ...
  export default {
    // ...
    data() {
      return {
        options: {
          index: 0,
          lazyload: true,
          useFade: true,
          click() {
            // user click event callback.
          }
        }
      }
    }
  }
</script>

The options contains many properties. All properties are listed below.

| Property | Type | default/params | Description | | ------ | ------ | ------ | ------ | | index | Number | 0 | Default image position index. | | autoplay | Boolean | false | Whether autoplay, not implement. | | interval | Number | 1000 | Autoplay interval mills, not implement. | | loop | Boolean | false | Playing slider with loop, not implement. | | clsName | String | - | Apply a css class on image element. | | gapWidth | Number | 0 | You can set a gap between each image.| | useFade | Boolean | false | Apply fade animation to image when appears. | | lazyload | Boolean | false | The image will be loaded only appears, if true. | | zoom | Boolean | false | You can zoom picture scale by gesture if set true, not implement.| | loading | String | - | It will be shown before loaded. A html template or characters are supported.| | error | String | - | It will be shown after load error. A html template or characters are supported.|
| hideIndicator | Boolen | false | Whether hide page number on bottom of image. As well, it can display 20 indicators at most.| | isDebug | Boolean | false | In Debug mode, slider will print some log infos by console.log. | | disableBounce | Boolen | false | Whether disable bounce when reached slider boundary. | | changed | Function | image | It will be fired when image position changed. | | click | Function | image | A click event fired on image element. | | longTap | Function | image | A longTap event on image element. | | longTapEnd | Function | image | It will be fired when the longTap event completes. |

Pull-left / Pull-right

You can move more when reached slider left or right boundary if you set disableBounce false. So, you can listen the event by setting the pull-left or pull-right property to slider as follows.

<template>
  <vue-html-slider :pull-left="pullLeft"></vue-html-slider>
</template>
<script>
  // ...
  export default {
    // ...
    data() {
      return {
        pullLeft: {
          tpl: '<div class="foo">query all</div>',
          pull(x) {
            // pulling continuously.
          },
          release(x) {
            // released.
          }
        }
      }
    }
  }
</script>

The pull-left and pull-right have three properties respectively as follows.

| Property | Type | params | Description | | ------ | ------ | ------ | ------ | | tpl | String | - | A html template will be shown when beyond slider boundary. Characters are also supported. | | pull | Function | x | A pull event will be fired continuously before released. | | release | Function | x | A release event will be fired when released. |

The pull or release parameter x refers to the distance that page leaves the boundary which is an absolute value.

License

This project is licensed under the MIT License. See the LICENSE.md file for details.