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

simple-slideshow-ur

v1.0.3

Published

A simple and customizable slideshow component for Vue.js, designed to display images with optional controls, indicators, and auto-slide functionality. This component is ideal for showcasing images in a responsive and user-friendly way.

Downloads

315

Readme

Simple Slideshow Library

A simple and customizable slideshow component for Vue.js, designed to display images with optional controls, indicators, and auto-slide functionality. This component is ideal for showcasing images in a responsive and user-friendly way.

Alt text

Features

  • Auto-slide functionality: Automatically transition between slides at a specified interval.
  • Pause on hover: Pause the slideshow when the user hovers over the images.
  • Customizable width and height: Adjust the size of the slideshow to fit your layout.
  • Next and previous buttons: Navigate through the slides manually (optional).
  • Slide indicators: Visual indicators that show which slide is active (optional).
  • Responsive design: Scales with different screen sizes to maintain a consistent appearance.

Installation

You can install this library via npm or yarn.

Using npm

npm install simple-slideshow-ur

Using yarn

yarn add simple-slideshow-ur

Usage

Once installed, you can use the Slideshow component in your Vue.js application. Below is a basic example of how to use it:

Basic Example

<template>
  <Slideshow 
    :slides="imageSlides" 
    :autoslide="true" 
    :interval="3000" 
    :pauseOnHover="true"
    width="100%" 
    height="400px" 
    :showButtons="true"
    :showIndicators="true"
  />
</template>

<script setup>
import Slideshow from 'simple-slideshow-ur';

const imageSlides = [
  'https://raw.githubusercontent.com/xfiveco/mock-api-images/main/images/img-01-xl.jpg',
  'https://raw.githubusercontent.com/xfiveco/mock-api-images/main/images/img-02-xs.jpg',
  'https://raw.githubusercontent.com/xfiveco/mock-api-images/main/images/img-04-xl.jpg',
  'https://via.placeholder.com/800x400?text=Slide+4',
];
</script>

Props

| Prop | Type | Default | Description | | -------------- | -------- | --------- | ----------------------------------------------------------------------------------------------------------------------------------------------------- | | slides | Array | [] | An array of image URLs to display in the slideshow. | | autoslide | Boolean| false | Enables automatic slide transition. | | interval | Number | 3000 | Time (in milliseconds) between each slide transition if autoslide is enabled. | | pauseOnHover | Boolean| false | Pauses the slideshow when the user hovers over it. | | width | String | '100%' | The width of the slideshow container. | | height | String | '400px' | The height of the slideshow container. | | showButtons | Boolean| true | Displays the "previous" and "next" navigation buttons. | | showIndicators| Boolean| true | Displays slide indicators, showing the current active slide. |

Customizing Buttons

You can also provide custom buttons by using the prev-button and next-button slots. Here's an example:

<Slideshow 
  :slides="imageSlides" 
  :autoslide="true" 
  :interval="3000" 
  :pauseOnHover="true"
  width="100%" 
  height="400px" 
  :showButtons="true"
>
  <template #prev-button>
    <button class="custom-prev-button">Previous</button>
  </template>
  <template #next-button>
    <button class="custom-next-button">Next</button>
  </template>
</Slideshow>

Styling

You can customize the appearance of the slideshow by overriding the styles in your global or component-level CSS. For example:

.custom-prev-button, .custom-next-button {
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
  padding: 10px;
  border: none;
  cursor: pointer;
  font-size: 16px;
}

Events

You can add additional interactions by handling events like keydown to allow keyboard navigation:

<Slideshow 
  :slides="imageSlides" 
  :autoslide="true" 
  :interval="3000" 
  :pauseOnHover="true"
  width="100%" 
  height="400px" 
  :showButtons="true"
  @keydown="handleKeydown"
/>

<script setup>
function handleKeydown(event) {
  if (event.key === 'ArrowRight') {
    // Handle next slide
  } else if (event.key === 'ArrowLeft') {
    // Handle previous slide
  }
}
</script>

Example Slideshow Usage

You can customize the functionality and appearance based on your requirements. The above example showcases a simple, responsive slideshow that you can easily integrate into your Vue.js application.

Contributing

Feel free to fork this repository and submit pull requests. All contributions are welcome!

License

This library is licensed under the MIT License.