Giter Club home page Giter Club logo

polymer-mat-slideshow's Introduction

mat-slideshow

Polymer material slideshow using materialize media slideshow component under the hood.

bower install polymer-mat-slideshow

Troubleshoot

For some reason, currently having trouble with this.each in materialize.js not working as expected:

See: http://stackoverflow.com/questions/3106414/in-jquery-how-does-the-this-each-work

return this.each(function() {
  // For each slider, we want to keep track of
  // which slide is active and its associated content

No idea why, not a jQuery plugin expert!

This element can be used something like this:

Global Configuration

In app/index.html

<head>
  <link rel="import" href="bower_components/polymer/polymer.html">  
  <link href="http://fonts.googleapis.com/icon?family=Material+Icons" rel="stylesheet">
  <!-- Import materialize.css -->
  <link type="text/css" rel="stylesheet" href="../bower_components/materialize/dist/css/materialize.min.css"  media="screen,projection"/>
  <!-- jQuery 2 dependency -->
  <script type="text/javascript" src="https://code.jquery.com/jquery-2.1.1.min.js"></script>
  <!-- Import materialize.js -->
  <script type="text/javascript" src="../bower_components/materialize/dist/js/materialize.min.js"></script>
</head>
<body>
  <!-- use custom slideshow element -->
  <my-slideshow id="my-slideshow" slideshow="{{ slideshow }}"></my-slideshow>

Import elements

In app/elements/elements.html

<!-- element imports -->
<link rel="import" href="../bower_components/mat-slideshow/mat-slideshow.html">
<!-- app element imports -->
<link rel="import" href="elements/my-slideshow/my-slideshow.html">

Use slideshow in custom element

Create custom element referenced by index.html

app/elements/my-slideshow/my-slideshow.html

<dom-module id="my-slideshow">
  <style>
    :host {
      display: block;
    }
  </style>

  <template>
    <mat-slides options="{{ slideshow.options }}">
      <template is="dom-repeat" items="{{ slideshow.items }}" as="slide">
        <mat-slide image="{{ slide.image }}" caption="{{ slide.caption }}"></mat-slide>
      </template>
    </mat-slides>
  </template>

</dom-module>

<script>
  Polymer({
    is: 'my-slideshow',

    properties: {
      slideshow: Object
    }
  });
</script>

Dependencies

Element dependencies are managed via Bower. You can install that via:

npm install -g bower

Then, go ahead and download the element's dependencies:

bower install

Playing With Your Element

If you wish to work on your element in isolation, we recommend that you usePolyserve to keep your element's bower dependencies in line. You can install it via:

npm install -g polyserve

And you can run it via:

polyserve

Once running, you can preview your element athttp://localhost:8080/components/mat-slideshow/, where mat-slideshow is the name of the directory containing it.

Testing Your Element

Simply navigate to the /test directory of your element to run its tests. If you are using Polyserve: http://localhost:8080/components/mat-slideshow/test/

web-component-tester

The tests are compatible with web-component-tester. Install it via:

npm install -g web-component-tester

Then, you can run your tests on all of your local browsers via:

wct

WCT Tips

wct -l chrome will only run tests in chrome.

wct -p will keep the browsers alive after test runs (refresh to re-run).

wct test/some-file.html will test only the files you specify.

polymer-mat-slideshow's People

Contributors

kristianmandrup avatar

Watchers

 avatar  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.