grain-responsive-behavior

WebJar for grain-responsive-behavior

License

License

MIT
GroupId

GroupId

org.webjars.bowergithub.dakmor
ArtifactId

ArtifactId

grain-responsive-behavior
Last Version

Last Version

0.8.1
Release Date

Release Date

Type

Type

jar
Description

Description

grain-responsive-behavior
WebJar for grain-responsive-behavior
Project URL

Project URL

http://webjars.org
Source Code Management

Source Code Management

https://github.com/daKmoR/grain-responsive-behavior

Download grain-responsive-behavior

How to add to project

<!-- https://jarcasting.com/artifacts/org.webjars.bowergithub.dakmor/grain-responsive-behavior/ -->
<dependency>
    <groupId>org.webjars.bowergithub.dakmor</groupId>
    <artifactId>grain-responsive-behavior</artifactId>
    <version>0.8.1</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.bowergithub.dakmor/grain-responsive-behavior/
implementation 'org.webjars.bowergithub.dakmor:grain-responsive-behavior:0.8.1'
// https://jarcasting.com/artifacts/org.webjars.bowergithub.dakmor/grain-responsive-behavior/
implementation ("org.webjars.bowergithub.dakmor:grain-responsive-behavior:0.8.1")
'org.webjars.bowergithub.dakmor:grain-responsive-behavior:jar:0.8.1'
<dependency org="org.webjars.bowergithub.dakmor" name="grain-responsive-behavior" rev="0.8.1">
  <artifact name="grain-responsive-behavior" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.bowergithub.dakmor', module='grain-responsive-behavior', version='0.8.1')
)
libraryDependencies += "org.webjars.bowergithub.dakmor" % "grain-responsive-behavior" % "0.8.1"
[org.webjars.bowergithub.dakmor/grain-responsive-behavior "0.8.1"]

Dependencies

compile (1)

Group / Artifact Type Version
org.webjars.bowergithub.polymer : polymer jar [2.0.0-rc.2,3.0)

Project Modules

There are no modules declared in this project.

Polymer Version

<grain-responsive-behavior>

Every element implementing this behavior do get an attribute for is-mobile, is-tablet, is-desktop when you resize the window. You can use this information to change styles and/or attributes depending on it.

Installation

$ bower install --save daKmoR/grain-responsive-behavior

Getting Started

Import the package.

<link rel="import" href="/bower_components/grain-responsive-behavior/grain-responsive-behavior.html">

Create your element using this behavior. You can now access is-mobile, is-tablet, is-desktop.

class GrainResponsiveBehaviorExample extends GrainResponsiveBehavior(Polymer.Element) {
  // your code
}

If you wish to have an responsive attribute you should create 3 attributes foo, mobileFoo, tabletFoo and init the Behavior with `this.initResponsiveBehaviorFor('foo');

class GrainResponsiveBehaviorExample extends GrainResponsiveBehavior(Polymer.Element) {
  static get is() { return 'grain-responsive-behavior-example' }

  static get properties() {
    return {
      marked: {
        type: String,
        reflectToAttribute: true,
        value: 'false', // 'true', 'false'
      },
      mobileMarked: { type: String, reflectToAttribute: true },
      tabletMarked: { type: String, reflectToAttribute: true },
    };
  }

  constructor() {
    super();
    this.initResponsiveBehaviorFor('marked');
  }
}

For more information, see the API documentation.

Working on the Element

First, make sure you have the Polymer CLI installed.

  • View the Element via polymer serve
  • Run tests via polymer test

Versions

Version
0.8.1