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

flexcardsjs-react

v2.0.9

Published

A Javascript library to improve your sliders, carousels and more, easily.

Downloads

3

Readme

Author License Downloads React downloads

Summary :

Functions

  • Controllers :
    • pause : Stops all animations.
    • play : Resume stopped animations.
  • Sliders :

Demo and documentation available here.

Variables

Here, the liste of all variables returned by the creation of a new flexcards.js instance :

  • components : An object containing all components used by the instance called.
  • container : The HTMLElement used by the flexcards.js instance.
  • delay : The delay used between every changes.
  • index : The index of the current slide showed.
  • length : Count of all slides.
  • playing : A boolean returning the current playing state.
  • refresh-time : An index representing the refresh the instance made. The more greater the index, the more number of refresh.
  • slides : An array with all the slides.
  • timeElapsed : Time elapsed before last slide change.

Usage

HTML5

Download

After downloading the flexcards.js file, you can follow the tutorial bellow to use flexcards.js. For more informations about the functions used, go to function category. If you don't want to download, you can use the UNPKG link :

https://unpkg.com/flexcardsjs@latest/index.min.js

Setup

  • In your HTML file, just put the link to the JS file :
<!-- In the header -->
<script src="./flexcards.min.js"></script>

<!-- Your component -->
<div id="flexcards">
    <!-- Articles are the items to display -->
    <article>Lorem ipsum</article>
    <article>Dolor sit</article>
    <article>Amet consectetur</article>
</div>
  • And in your JavaScript app.js or your <script> tag you can simply create a new instance of flexcards.js like the following example :
const flexcards = new FlexCards("#flexcards"); // your JS selector

// Then chose what you want to display with flexcards.js
flexcards.carousel(); // e.g. carousel

Adding parameters

Check the parameters list to get more informations about.
In HTML with the <script> tag or in JavaScript :

const flexcards = new FlexCards("#flexards");

// Example with the carousel :
flexcards.carousel({ theme: '#f00' });

React

Installation

Run this npm command in your command line tool in a React project. Then you can start using this package thanks to the example bellow.

$ npm install --save flexcardsjs-react

React setup and parameters

  1. Before anything, you must import the components of the package, like this :
import FlexCards from 'flexcards-react';
// or
import { Component } from 'flexcards-react';
  1. Usage of components :
    Only custom elements comming from the FlexCards package an be used into the flexcards.js instance you want use.
const App = () => (
    <Carousel theme="#f56" delay={7500}>
        <Component>
            <h2>Some title</h2>
            Lorem ipsum dolor sit amet consectetur...
        </Component>

        <ImageComponent src="http://example.org/image.png">
    </Carousel>
);

React components

  • Carousel : An amazing and well powered carousel.
    The attributes which can be added are the same of those in the parameters section.
  • Component : A custom component wherever you can put what you want into (basically, it's an article).
  • ImageComponent : A slide with only one image

Parameters

Parameters can be added in JSON format in the function called thanks to the flexcards.js instance. Here you'll found, the list of all the parameters and the values you can put. To see how it works to used the parameters, check this link.

  • arrowUrl : if a string is provided, will use the path of the image to use.

  • colorized : default true, apply a filter to the arrow (work better on black images) to have a color that matches the theme. To see how the RGBtoHSL object work to apply a filter converting an RGB color provided into an HSL color, click on the link in the thanks section.

  • component : default will use the article tags and images will use <img> tags. This parameter is an exception and must be added next the selector (JSON Format) when the new instance is created.

  • indexType <dots | numbers | undefined> : dots by default will display some dots at the bottom of the box that can be used to navigate. numbers will display a classic index with the current slide number. If any of these parameter are defined, there will be nothing.

  • theme : An hexadecimal color code (like in CSS) of 3 or 6 digits that will be applied to the components provided by flexcards.js (default: #444).

  • timer : by default to true, this attribute will indicate wether a progress bar should be displayed at the top of the flexcards.js instance or not.

Thanks

RGBtoHSL

I just customize the code found this StackOverflow subject. So all credits goes to the posts on this subject and especially to MultiplyByZer0.