Recently google released Polymer 1.0.
Hope you will like it
In 0.5 Polymer element collection: https://www.polymer-project.org/0.5/docs/elements/
Polymer's core elements - https://www.polymer-project.org/0.5/docs/elements/core-ajax.html
Polymer's paper elements - https://www.polymer-project.org/0.5/docs/elements/paper-button.html
For using polymer in visualforce page. We need to add
<script src="https://www.polymer-project.org/0.5/components/webcomponentsjs/webcomponents.js"></script>
Webcomponent script
Below is the Polymer core-pages example
<apex:page showHeader="false">
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<title>core-pages</title>
<script src="https://www.polymer-project.org/0.5/components/webcomponentsjs/webcomponents.js"></script>
<link rel="import" href="https://www.polymer-project.org/0.5/components/core-pages/core-pages.html"/>
<style>
html, body {
height: 100%;
}
body {
font-family: sans-serif;
}
core-pages {
width: 300px;
height: 300px;
border: 1px solid black;
-webkit-user-select: none;
border-radius: 5px;
}
core-pages > div {
display: flex;
justify-content: center;
align-items: center;
border-radius: inherit;
}
core-pages.fancy {
border: none;
margin-left: 2em;
}
core-pages.fancy > div {
opacity: 0;
-webkit-transform: translate3d(-100px, 0, 0) scale(0.9);
transform: translate3d(-100px, 0, 0) scale(0.9);
transition: all 1s cubic-bezier(.03,.56,.7,.98);
color: white;
}
core-pages.fancy > .one {
background-color: red;
}
core-pages.fancy > .two {
background-color: green;
}
core-pages.fancy > .three {
background-color: blue;
}
core-pages.fancy > .four {
background-color: purple;
}
core-pages.fancy > .five {
background-color: black;
}
core-pages.fancy .core-selected + div {
-webkit-transform: translate3d(100px, 0, 0) scale(0.9);
transform: translate3d(100px, 0, 0) scale(1);
}
core-pages.fancy .core-selected {
opacity: 1;
-webkit-transform: translateX(0);
transform: translateX(0);
}
core-pages.fancy div.begin {
-webkit-transform: translate3d(100px, 0, 0) scale(0.9);
transform: translate3d(100px, 0, 0) scale(0.9);
}
</style>
</head>
<body unresolved="unresolved" fullbleed="fullbleed" horizontal="horizontal" center="center" center-justified="center-justified" layout="layout">
<core-pages id="first" selected="0">
<div>One</div>
<div>Two</div>
<div>Three</div>
<div>Four</div>
<div>Five</div>
</core-pages>
<core-pages class="fancy" selected="0">
<div class="one">One</div>
<div class="two">Two</div>
<div class="three">Three</div>
<div class="four">Four</div>
<div class="five">Five</div>
</core-pages>
<script>
document.querySelector('#first').onclick = function(e) {
this.selected = (this.selected + 1) % this.items.length;
};
document.querySelector('core-pages.fancy').onclick = function(e) {
this.selected = (this.selected + 1) % this.items.length;
this.async(function() {
if (this.selectedIndex == 0) {
this.selectedItem.classList.remove('begin');
} else if (this.selectedIndex == this.items.length - 1) {
this.items[0].classList.add('begin');
}
});
};
</script>
</body>
</apex:page>
Demo: https://www.polymer-project.org/0.5/components/core-elements/demo.html#core-pages
--------------------------------------------------------------------------------------------------------------------------
Hope you will like it
In 0.5 Polymer element collection: https://www.polymer-project.org/0.5/docs/elements/
Polymer's core elements - https://www.polymer-project.org/0.5/docs/elements/core-ajax.html
Polymer's paper elements - https://www.polymer-project.org/0.5/docs/elements/paper-button.html
For using polymer in visualforce page. We need to add
<script src="https://www.polymer-project.org/0.5/components/webcomponentsjs/webcomponents.js"></script>
Webcomponent script
Below is the Polymer core-pages example
<apex:page showHeader="false">
<head>
<meta charset="utf-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
<title>core-pages</title>
<script src="https://www.polymer-project.org/0.5/components/webcomponentsjs/webcomponents.js"></script>
<link rel="import" href="https://www.polymer-project.org/0.5/components/core-pages/core-pages.html"/>
<style>
html, body {
height: 100%;
}
body {
font-family: sans-serif;
}
core-pages {
width: 300px;
height: 300px;
border: 1px solid black;
-webkit-user-select: none;
border-radius: 5px;
}
core-pages > div {
display: flex;
justify-content: center;
align-items: center;
border-radius: inherit;
}
core-pages.fancy {
border: none;
margin-left: 2em;
}
core-pages.fancy > div {
opacity: 0;
-webkit-transform: translate3d(-100px, 0, 0) scale(0.9);
transform: translate3d(-100px, 0, 0) scale(0.9);
transition: all 1s cubic-bezier(.03,.56,.7,.98);
color: white;
}
core-pages.fancy > .one {
background-color: red;
}
core-pages.fancy > .two {
background-color: green;
}
core-pages.fancy > .three {
background-color: blue;
}
core-pages.fancy > .four {
background-color: purple;
}
core-pages.fancy > .five {
background-color: black;
}
core-pages.fancy .core-selected + div {
-webkit-transform: translate3d(100px, 0, 0) scale(0.9);
transform: translate3d(100px, 0, 0) scale(1);
}
core-pages.fancy .core-selected {
opacity: 1;
-webkit-transform: translateX(0);
transform: translateX(0);
}
core-pages.fancy div.begin {
-webkit-transform: translate3d(100px, 0, 0) scale(0.9);
transform: translate3d(100px, 0, 0) scale(0.9);
}
</style>
</head>
<body unresolved="unresolved" fullbleed="fullbleed" horizontal="horizontal" center="center" center-justified="center-justified" layout="layout">
<core-pages id="first" selected="0">
<div>One</div>
<div>Two</div>
<div>Three</div>
<div>Four</div>
<div>Five</div>
</core-pages>
<core-pages class="fancy" selected="0">
<div class="one">One</div>
<div class="two">Two</div>
<div class="three">Three</div>
<div class="four">Four</div>
<div class="five">Five</div>
</core-pages>
<script>
document.querySelector('#first').onclick = function(e) {
this.selected = (this.selected + 1) % this.items.length;
};
document.querySelector('core-pages.fancy').onclick = function(e) {
this.selected = (this.selected + 1) % this.items.length;
this.async(function() {
if (this.selectedIndex == 0) {
this.selectedItem.classList.remove('begin');
} else if (this.selectedIndex == this.items.length - 1) {
this.items[0].classList.add('begin');
}
});
};
</script>
</body>
</apex:page>
Demo: https://www.polymer-project.org/0.5/components/core-elements/demo.html#core-pages
--------------------------------------------------------------------------------------------------------------------------
No comments:
Post a Comment