Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

enso-carousel

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

enso-carousel

A renderless Vue component carousel.

  • 1.0.0
  • Source
  • npm
  • Socket score

Version published
Maintainers
1
Created
Source

A renderless Vue component carousel.

Installation

Use npm

npm install --save enso-carousel

or yarn

yarn add enso-carousel

Usage

MyCarousel.vue

<template>
  <enso-carousel
    @change="onChange"
    @ready="onReady"
    :slides="[
      {
        content: 'This is my carousel. Here is the first slide.',
      },
      {
        content: 'This is the second slide.',
      },
      {
        content: 'And here is the third slide.',
      },
    ]"
  >
    <div class="enso-carousel" slot-scope="{ prev, next, goto, isCurrentIndex, slides }">
      <slide
        class="enso-carousel__slide"
        v-for="(slide, index) in slides"
        :key="'slide' + index"
        v-bind="slide"
      ></slide>

      <button @click="prev">
        Previous
      </button>
      <button @click="next">
        Next
      </button>

      <ul>
        <li v-for="(slide, index) in slides" :key="index">
          <button @click="goto(index)" :class="{ 'is-active': isCurrentIndex(index) }">
            {{ index }}
          </button>
        </li>
      </ul>
    </div>
  </enso-carousel>
</template>

<script>
export default {
  methods: {
    onReady(slide) {
      console.log('The carousel is ready. This slide is showing.', slide);
    },
    onChange(slide) {
      console.log('A different slide was selected.', slide);
    },
  },
};
</script>

MySlide.vue

<template>
  <div>
    {{ content }}
  </div>
</template>

<script>
export default {
  props: {
    content: String,
  },
};
</script>

Props

  • slides - Array of slides
  • threshold - Number of pixels to drag before counting it as dragging to a new slide. Default 100.

Events

  • ready(slide)
  • change(slide)
  • drag-start
  • drag-move
  • drag-end

Methods

  • prev()
  • next()
  • goto(index)
  • isCurrentIndex(index)

Limitations

CSS limits the slides to being 100vw.

Keywords

FAQs

Package last updated on 20 Sep 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc