Code Monkey home page Code Monkey logo

tm-page-slider's Introduction

Published on webcomponents.org Published on Vaadin  Directory Stars on vaadin.com/directory

< tm-page-slider >

Polymer element for displaying slides in a carousel. Have a quick look at the Component page

Screenshot

Install with bower

First you need bower, see their site for details

bower install --save tm-page-slider

Examples

Each slide must be within a paper-slide tag, but other than that you have complete control.

  <tm-page-slider>
    <paper-slide>#1</paper-slide>
    <paper-slide>#2</paper-slide>
    <paper-slide>#3</paper-slide>
    <paper-slide>#4</paper-slide>
  </tm-page-slider>

There is also auto progression and slide duration for how long it should remain on one slide

  <tm-page-slider auto-progress slide-duration="2">
    <paper-slide>#1</paper-slide>
    <paper-slide>#2</paper-slide>
    <paper-slide>#3</paper-slide>
  </tm-page-slider>

You can set a different default start position, the first start postion is 0 (as opposed to 1)

  <tm-page-slider position="1">
    <paper-slide>#1</paper-slide>
    <paper-slide>#2</paper-slide>
  </tm-page-slider>

Styling

The following custom properties are available for styling:

Custom property Description Default
--paper-slider-styles (Mixin) Customs styles for slider container NULL
--paper-slide-dot Color of unselected Nav Dot rgba(255, 255, 255, .5)
--paper-slide-dot-selected Color of selected Nav Dot #FFF
--paper-slide-width Width of slide container 100%
--paper-slide-height Height of slide container 600px
--paper-slider-dot-container-styles (Mixin) Custom styles for dot container NULL
--paper-slide-dot-styles (Mixin) Custom styles for dot NULL
--paper-slide-background Default background color for slides rgba(0, 0, 0, 0)
--paper-slide-font-size Default font size for slide medium

Attributes

Public

Attribute Name Functionality Type Default
totalSlides Number for storing total number of slides Number NULL
autoProgress Boolean value to state if slides should auto proceed Boolean false
slideDuration Number of seconds each slide should remain for Number 5
hideNav Boolean value to state if nav should should hidden Boolean false
position Number for storing start position of slides Number 0
disableSwipe Boolean value to state if swipe shoud work Boolean false
sensitivity String to storing high, low or default swipe sensitivity String 'default'

Private

Attribute Name Functionality Type Default
_totalDots Array for storing number leading up to totalSlides Array []
_dotStyles Object for storing all the styles of the dot elements Object NULL

Methods

Public

Method Name Action
moveNext() Method for moving to the next slide or back to the first slide
movePrev() Method for moving to the previous slide or to the last slide
movePos(slide) Method for moving to a specific slide

Private

Method Name Action
_autoProceed() Method for moving automatically ever slideDuration seconds
_countSlides() Count the slides, and set totalSlides
_createDots(t) Create the nav dots 1 for each slide
_animateCSS() Method for styling and animating dots
_listenerInit() Adds onclick listener To update the position
_reInit() Method to reinitialise on totalSlides change
_swipeHandler(e) Method for adding swipe event handler

Credit

I adapted this project from Tobias Reich's project Material Slider Dots. The code is mostly his, I just made it more dynamic for a polymer enviroment.

tm-page-slider's People

Contributors

tmcmaster avatar

Watchers

James Cloos avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.