1.1.4 • Published 7 years ago

a-carousel v1.1.4

Weekly downloads
1
License
ISC
Repository
-
Last release
7 years ago

A Carousel

Description

A React Project to simplify UI Carousels

Examples of a-carousel


Setup a-carousel

Package Manager

// npm
npm install a-carousel

// yarn
yarn add a-carousel

Include the CSS file

  1. webpack [recommended]
  2. import the file directly
  3. grunt

Example (include link here)

<div style={{width: '50%', margin: '0 auto'}}>
  <Carousel>
    <div>
      <h1> 1 </h1>
    </div>
    <div>
      <h1> 2 </h1>
    </div>
    <div>
      <h1> 3 </h1>
    </div>
  </Carousel>
</div>

CSS Option 1: Webpack recommended       Require the css file from a-carousel in the parent component: Eg. \<App /> or index.js       import 'a-carousel/build/styles.css';

      Add css-loader and style-loader with:       yarn add css-loader style-loader --dev or npm install css-loader style-loader --save-dev

      Add the loaders to your webpack.config.js to allow for CSS imports:       {test: /\.css$/,loader: "style-loader!css-loader"}

      Now just build with webpack and voila

CSS Option 2: Direct Link       Add the \<link> to the HTML file: Note: adjust to meet the correct path       <link rel='stylesheet' type='text/css' href='CORRECT-PATH/node_modules/a-carousel/build/styles.css' />

CSS Option 3: Grunt       Need to create a solution for grunt


Options

DonePropertyTypeDefaultValuesDescription
accessabilitybooleantruetruefalse...FIX!!! Enables tabbing and arrow key navigation. Unless autoplay: true, sets browser focus to current slide (or first of current slide set, if multiple slidesToShow) after slide change. For full a11y compliance enable focusOnChange in addition to this.
arrowbooleantruetrue, falseEnable the next and previous buttons on the carousel
arrowPositionstringinsideoutsideinsidebottombelowDetermines the location of the next/prev arrow placement
arrowStyleBackwardstringdefaultdefault\<classname>Applies the default styling or a custom classname for styling to the backward arrow. In the custom classname, utilize CSS properties: top, bottom, left, right for position of arrow. Utilize CSS properties: width, height, background-color, background-image, border etc. for styling of arrow.
arrowStyleForwardstringdefaultdefault\<classname>Applies the default styling or a custom classname for styling to the forward arrow. In the custom classname, utilize CSS properties: top, bottom, left, rightfor position of arrow. Utilize CSS properties: width, height, background-color, background-image, border etc. for styling of arrow.
autoplaybooleanfalsetruefalseAutomatically scroll through the slides inside the carousel
autoplaySpeednumber3(s)any number > 0Determines the amount of time spent before moving to the next carousel slide
speednumber0.3(s)any number > 0Determines the transition speed of the carousel slides in seconds
timingstringease-in-outRefer to: W3School CSS Transition-Timing-Property for all possible valuesDetermines the transition timing function of the carousel slides
dotsbooleanfalsetruefalseEnable slide navigation dots to show the current slide
dotsClickbooleantruetruefalseEnables indicator dots to be clickable to go to particular slide numbers
dotsStylestringdefaultdefault\<classname>Applies the default styling or a custom classname for styling the dots navigation
dotsPositionstringbelowbottombelowDetermines the location of the dots navigation. Can be overrided by dotsStyle and adding position styling attributes
touchbooleantruetruefalseEnabled touch scrolling of the carousel
touchThresholdnumber0.50 < number <= 1To swipe a slide, you must scroll thos ratio of the slide
z-indexnumber......Sets the z-index of the carousel
infinitebooleantruetruefalseDetermines if you can scroll infinitely through the slides
initialSlidenumber00 < number < # of slidesDetermines which slide the carousel starts on
allowButtonSpambooleanfalsetruefalseDetermines if you can spam click the forward/backward button or if you need to wait for the animation to finish

To add additional styling to Carousel

ElementClassname
Previous Slide ButtonbackwardButtonCarousel
Next Slide ButtonforwardButtonCarousel
Navigation DotsdotsCarousel
Individual Nav DotsdotsChildren
......

FAQ

These are some common issues people have with setting up and using the a-carousel module.

Error Messages

Error NumberDescription
1Must have 2 or more children elements within the Carousel Component to be considered valid
2Must enter a boolean for the arrow property
3Must enter a number > 0 for the speed property
4Must enter a valid CSS-transition-timing-function. Refer to https://www.w3schools.com/cssref/css3_pr_transition-timing-function.asp
5Must enter a boolean for the autoplay property
6Must enter a number > 0 for the autoplaySpeed property
7Must enter one of: outside, inside, bottom, below`
8Must enter a string for the arrowStyleBackward property
9Must enter a string for the arrowStyleForward property
10Must enter a boolean for the dots property
11just enter a boolean value for the dotsClick property
12Must enter a (int) number between 0 and (#slides - 1) for the initialSlide property
13Must enter a string value for the property

To Do List

  1. optimize and minify build files // maybe change to webpack
  2. finish Touch features
1.1.4

7 years ago

1.1.3

7 years ago

1.1.2

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.17

7 years ago

1.0.16

7 years ago

1.0.15

7 years ago

1.0.14

7 years ago

1.0.13

7 years ago

1.0.12

7 years ago

1.0.11

7 years ago

1.0.10

7 years ago

1.0.9

7 years ago

1.0.8

7 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.4

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago