mirror of
https://github.com/CoderSherlock/CoderSherlock.github.io.git
synced 2026-06-13 08:08:10 -07:00
I_changed_another_theme
This commit is contained in:
@@ -0,0 +1,48 @@
|
||||
{
|
||||
"name": "paper-scroll-header-panel",
|
||||
"description": "A header bar with scrolling behavior",
|
||||
"version": "1.0.4",
|
||||
"license": "http://polymer.github.io/LICENSE.txt",
|
||||
"private": true,
|
||||
"authors": "The Polymer Authors",
|
||||
"keywords": [
|
||||
"web-components",
|
||||
"polymer",
|
||||
"layout",
|
||||
"responsive"
|
||||
],
|
||||
"main": [
|
||||
"paper-scroll-header-panel.html"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/PolymerElements/paper-scroll-header-panel.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"polymer": "Polymer/polymer#^1.0.0",
|
||||
"paper-toolbar": "PolymerElements/paper-toolbar#^1.0.0",
|
||||
"iron-resizable-behavior": "PolymerElements/iron-resizable-behavior#^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"paper-styles": "PolymerElements/paper-styles#^1.0.0",
|
||||
"iron-flex-layout": "PolymerElements/iron-flex-layout#^1.0.0",
|
||||
"iron-media-query": "PolymerElements/iron-media-query#^1.0.0",
|
||||
"iron-icons": "PolymerElements/iron-icons#^1.0.0",
|
||||
"paper-icon-button": "PolymerElements/paper-icon-button#^1.0.0",
|
||||
"paper-input": "PolymerElements/paper-input#^1.0.0",
|
||||
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
|
||||
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
|
||||
"web-component-tester": "*",
|
||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||
},
|
||||
"homepage": "https://github.com/PolymerElements/paper-scroll-header-panel",
|
||||
"_release": "1.0.4",
|
||||
"_resolution": {
|
||||
"type": "version",
|
||||
"tag": "v1.0.4",
|
||||
"commit": "13f17709ce666adf2ab25161bc180816c53e7583"
|
||||
},
|
||||
"_source": "git://github.com/PolymerElements/paper-scroll-header-panel.git",
|
||||
"_target": "^1.0.0",
|
||||
"_originalSource": "PolymerElements/paper-scroll-header-panel"
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
bower_components
|
||||
@@ -0,0 +1,56 @@
|
||||
paper-scroll-header-panel
|
||||
========================
|
||||
|
||||
`paper-scroll-header-panel` contains a header section and a content section. The header is initially on the top part of the view but it scrolls away with the rest of the scrollable content. Upon scrolling slightly up at any point, the header scrolls back into view. This saves screen space and allows users to access important controls by easily moving them back to the view.
|
||||
|
||||
Important: The `paper-scroll-header-panel` will not display if its parent does not have a height. Using layout classes, you can easily make the `paper-scroll-header-panel` fill the screen
|
||||
|
||||
```html
|
||||
<body class="fullbleed layout vertical">
|
||||
<paper-scroll-header-panel class="flex">
|
||||
<paper-toolbar>
|
||||
Hello World!
|
||||
</paper-toolbar>
|
||||
</paper-scroll-header-panel>
|
||||
</body>
|
||||
```
|
||||
or, if you would prefer to do it in CSS, just give html, body, and `paper-scroll-header-panel` a height of 100%:
|
||||
```css
|
||||
html, body {
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
paper-scroll-header-panel {
|
||||
height: 100%;
|
||||
}
|
||||
```
|
||||
`paper-scroll-header-panel` works well with `paper-toolbar` but can use any element that represents a header by adding a `paper-header` class to it.
|
||||
|
||||
```html
|
||||
<paper-scroll-header-panel>
|
||||
<paper-toolbar>Header</paper-toolbar>
|
||||
<div>Content goes here...</div>
|
||||
</paper-scroll-header-panel>
|
||||
```
|
||||
|
||||
### Styling scroll-header-panel:
|
||||
|
||||
To change background for toolbar when it is at its full size:
|
||||
|
||||
```css
|
||||
paper-scroll-header-panel {
|
||||
--paper-scroll-header-panel-full-header: {
|
||||
background-color: red;
|
||||
};
|
||||
}
|
||||
```
|
||||
|
||||
To change the background for toolbar when it is condensed:
|
||||
|
||||
```css
|
||||
paper-scroll-header-panel {
|
||||
--paper-scroll-header-panel-condensed-header: {
|
||||
background-color: #f4b400;
|
||||
};
|
||||
}
|
||||
```
|
||||
@@ -0,0 +1,38 @@
|
||||
{
|
||||
"name": "paper-scroll-header-panel",
|
||||
"description": "A header bar with scrolling behavior",
|
||||
"version": "1.0.4",
|
||||
"license": "http://polymer.github.io/LICENSE.txt",
|
||||
"private": true,
|
||||
"authors": "The Polymer Authors",
|
||||
"keywords": [
|
||||
"web-components",
|
||||
"polymer",
|
||||
"layout",
|
||||
"responsive"
|
||||
],
|
||||
"main": [
|
||||
"paper-scroll-header-panel.html"
|
||||
],
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/PolymerElements/paper-scroll-header-panel.git"
|
||||
},
|
||||
"dependencies": {
|
||||
"polymer": "Polymer/polymer#^1.0.0",
|
||||
"paper-toolbar": "PolymerElements/paper-toolbar#^1.0.0",
|
||||
"iron-resizable-behavior": "PolymerElements/iron-resizable-behavior#^1.0.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"paper-styles": "PolymerElements/paper-styles#^1.0.0",
|
||||
"iron-flex-layout": "PolymerElements/iron-flex-layout#^1.0.0",
|
||||
"iron-media-query": "PolymerElements/iron-media-query#^1.0.0",
|
||||
"iron-icons": "PolymerElements/iron-icons#^1.0.0",
|
||||
"paper-icon-button": "PolymerElements/paper-icon-button#^1.0.0",
|
||||
"paper-input": "PolymerElements/paper-input#^1.0.0",
|
||||
"iron-component-page": "PolymerElements/iron-component-page#^1.0.0",
|
||||
"test-fixture": "PolymerElements/test-fixture#^1.0.0",
|
||||
"web-component-tester": "*",
|
||||
"webcomponentsjs": "webcomponents/webcomponentsjs#^0.7.0"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
@license
|
||||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>paper-scroll-header-panel: demo1</title>
|
||||
|
||||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
|
||||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
||||
|
||||
<link rel="import" href="../paper-scroll-header-panel.html">
|
||||
<link rel="import" href="../../paper-toolbar/paper-toolbar.html">
|
||||
<link rel="import" href="../../iron-icons/iron-icons.html">
|
||||
<link rel="import" href="../../paper-icon-button/paper-icon-button.html">
|
||||
<link rel="import" href="sample-content.html">
|
||||
|
||||
<link rel="stylesheet" href="../../paper-styles/demo.css">
|
||||
|
||||
<style is="custom-style">
|
||||
|
||||
paper-scroll-header-panel {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background-color: var(--paper-grey-200, #eee);;
|
||||
}
|
||||
|
||||
paper-toolbar {
|
||||
background-color: var(--google-blue-500, #4285f4);
|
||||
}
|
||||
|
||||
paper-toolbar iron-icon {
|
||||
margin: 0 8px;
|
||||
}
|
||||
|
||||
paper-toolbar .title {
|
||||
margin: 0 8px;
|
||||
}
|
||||
|
||||
paper-scroll-header-panel .content {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<paper-scroll-header-panel>
|
||||
|
||||
<paper-toolbar>
|
||||
|
||||
<paper-icon-button icon="arrow-back"></paper-icon-button>
|
||||
<div class="flex title">Title</div>
|
||||
<paper-icon-button icon="search"></paper-icon-button>
|
||||
<paper-icon-button icon="more-vert"></paper-icon-button>
|
||||
|
||||
</paper-toolbar>
|
||||
|
||||
<div class="content">
|
||||
|
||||
<sample-content size="100"></sample-content>
|
||||
|
||||
</div>
|
||||
|
||||
</paper-scroll-header-panel>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,78 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
@license
|
||||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>paper-scroll-header-panel: demo2</title>
|
||||
|
||||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
|
||||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
||||
|
||||
<link rel="import" href="../paper-scroll-header-panel.html">
|
||||
<link rel="import" href="../../paper-toolbar/paper-toolbar.html">
|
||||
<link rel="import" href="../../iron-icons/iron-icons.html">
|
||||
<link rel="import" href="../../paper-icon-button/paper-icon-button.html">
|
||||
<link rel="stylesheet" href="../../paper-styles/demo.css">
|
||||
<link rel="import" href="sample-content.html">
|
||||
|
||||
<style is="custom-style">
|
||||
|
||||
paper-scroll-header-panel {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background-color: var(--paper-grey-200, #eee);
|
||||
}
|
||||
|
||||
paper-toolbar {
|
||||
background-color: var(--google-blue-500, #4285f4);
|
||||
}
|
||||
|
||||
paper-toolbar .title {
|
||||
margin-left: 60px;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<paper-scroll-header-panel condenses>
|
||||
|
||||
<paper-toolbar class="tall">
|
||||
|
||||
<paper-icon-button icon="arrow-back"></paper-icon-button>
|
||||
<div class="flex"></div>
|
||||
<paper-icon-button icon="search"></paper-icon-button>
|
||||
<paper-icon-button icon="more-vert"></paper-icon-button>
|
||||
|
||||
<div class="bottom title">Title</div>
|
||||
|
||||
</paper-toolbar>
|
||||
|
||||
<div class="content">
|
||||
|
||||
<sample-content size="100"></sample-content>
|
||||
|
||||
</div>
|
||||
|
||||
</paper-scroll-header-panel>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,79 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
@license
|
||||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>paper-scroll-header-panel: demo3</title>
|
||||
|
||||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
|
||||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
||||
|
||||
<link rel="import" href="../paper-scroll-header-panel.html">
|
||||
<link rel="import" href="../../paper-toolbar/paper-toolbar.html">
|
||||
<link rel="import" href="../../iron-icons/iron-icons.html">
|
||||
<link rel="import" href="../../paper-icon-button/paper-icon-button.html">
|
||||
<link rel="stylesheet" href="../../paper-styles/demo.css">
|
||||
<link rel="import" href="sample-content.html">
|
||||
|
||||
<style is="custom-style">
|
||||
|
||||
paper-scroll-header-panel {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background-color: var(--paper-grey-200, #eee);
|
||||
|
||||
/* background for toolbar when it is at its full size */
|
||||
--paper-scroll-header-panel-full-header: {
|
||||
background-image: url(images/bg3.jpg);
|
||||
};
|
||||
}
|
||||
|
||||
paper-toolbar {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
paper-toolbar iron-icon {
|
||||
margin: 0 8px;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<paper-scroll-header-panel condenses no-reveal no-dissolve>
|
||||
|
||||
<paper-toolbar class="tall">
|
||||
|
||||
<div class="flex"></div>
|
||||
<paper-icon-button icon="search"></paper-icon-button>
|
||||
|
||||
</paper-toolbar>
|
||||
|
||||
<div class="content">
|
||||
|
||||
<sample-content size="100"></sample-content>
|
||||
|
||||
</div>
|
||||
|
||||
</paper-scroll-header-panel>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,114 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
@license
|
||||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>paper-scroll-header-panel: demo4</title>
|
||||
|
||||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
|
||||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
||||
|
||||
<link rel="import" href="../paper-scroll-header-panel.html">
|
||||
<link rel="import" href="../../paper-toolbar/paper-toolbar.html">
|
||||
<link rel="import" href="../../iron-icons/iron-icons.html">
|
||||
<link rel="import" href="../../paper-icon-button/paper-icon-button.html">
|
||||
<link rel="import" href="sample-content.html">
|
||||
|
||||
<link rel="stylesheet" href="../../paper-styles/demo.css">
|
||||
|
||||
|
||||
<style is="custom-style">
|
||||
|
||||
paper-scroll-header-panel {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background-color: var(--paper-grey-200, #eee);
|
||||
|
||||
/* background for toolbar when it is at its full size */
|
||||
--paper-scroll-header-panel-full-header: {
|
||||
background-image: url(images/bg6.jpg);
|
||||
};
|
||||
|
||||
/* background for toolbar when it is condensed */
|
||||
--paper-scroll-header-panel-condensed-header: {
|
||||
background-color: var(--paper-deep-orange-500, #ff5722);
|
||||
};
|
||||
}
|
||||
|
||||
paper-toolbar.tall {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
paper-toolbar.tall .title {
|
||||
font-size: 40px;
|
||||
margin-left: 60px;
|
||||
|
||||
-webkit-transform-origin: left center;
|
||||
transform-origin: left center;
|
||||
|
||||
/* Issue #15 */
|
||||
isolation: isolate;
|
||||
}
|
||||
|
||||
paper-toolbar.tall iron-icon {
|
||||
margin: 0 8px;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<paper-scroll-header-panel condenses>
|
||||
|
||||
<paper-toolbar class="tall">
|
||||
|
||||
<paper-icon-button icon="arrow-back"></paper-icon-button>
|
||||
<div class="flex"></div>
|
||||
<paper-icon-button icon="search"></paper-icon-button>
|
||||
<paper-icon-button icon="more-vert"></paper-icon-button>
|
||||
<div class="bottom title">Title</div>
|
||||
|
||||
</paper-toolbar>
|
||||
|
||||
<div class="content">
|
||||
|
||||
<sample-content size="100"></sample-content>
|
||||
|
||||
</div>
|
||||
|
||||
</paper-scroll-header-panel>
|
||||
|
||||
<script>
|
||||
|
||||
// custom transformation: scale header's title
|
||||
var title = document.querySelector('.title');
|
||||
addEventListener('paper-header-transform', function(e) {
|
||||
var d = e.detail;
|
||||
var m = d.height - d.condensedHeight;
|
||||
var scale = Math.max(0.75, (m - d.y) / (m / 0.25) + 0.75);
|
||||
|
||||
Polymer.Base.transform('scale(' + scale + ') translateZ(0)', title);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,113 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
@license
|
||||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>paper-scroll-header-panel: demo5</title>
|
||||
|
||||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
|
||||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
||||
|
||||
<link rel="import" href="../paper-scroll-header-panel.html">
|
||||
<link rel="import" href="../../paper-toolbar/paper-toolbar.html">
|
||||
<link rel="import" href="../../iron-icons/iron-icons.html">
|
||||
<link rel="import" href="../../paper-icon-button/paper-icon-button.html">
|
||||
<link rel="import" href="sample-content.html">
|
||||
|
||||
<link rel="stylesheet" href="../../paper-styles/demo.css">
|
||||
|
||||
<style is="custom-style">
|
||||
|
||||
paper-scroll-header-panel {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background-color: var(--paper-grey-200, #eee);
|
||||
|
||||
/* background for toolbar when it is at its full size */
|
||||
--paper-scroll-header-panel-full-header: {
|
||||
background-image: url(images/bg6.jpg);
|
||||
};
|
||||
|
||||
/* background for toolbar when it is condensed */
|
||||
--paper-scroll-header-panel-condensed-header: {
|
||||
background-color: var(--google-yellow-500, #f4b400);
|
||||
};
|
||||
}
|
||||
|
||||
paper-toolbar.tall {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
paper-toolbar.tall .title {
|
||||
font-size: 40px;
|
||||
margin-left: 60px;
|
||||
|
||||
-webkit-transform-origin: left center;
|
||||
transform-origin: left center;
|
||||
|
||||
/* Issue #15 */
|
||||
isolation: isolate;
|
||||
}
|
||||
|
||||
paper-toolbar.tall iron-icon {
|
||||
margin: 0 8px;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<paper-scroll-header-panel condenses>
|
||||
|
||||
<paper-toolbar class="tall">
|
||||
|
||||
<paper-icon-button icon="arrow-back"></paper-icon-button>
|
||||
<div class="flex"></div>
|
||||
<paper-icon-button icon="search"></paper-icon-button>
|
||||
<paper-icon-button icon="more-vert"></paper-icon-button>
|
||||
<div class="bottom title">Title</div>
|
||||
|
||||
</paper-toolbar>
|
||||
|
||||
<div class="content">
|
||||
|
||||
<sample-content size="100"></sample-content>
|
||||
|
||||
</div>
|
||||
|
||||
</paper-scroll-header-panel>
|
||||
|
||||
<script>
|
||||
|
||||
// custom transformation: scale header's title
|
||||
var title = document.querySelector('.title');
|
||||
addEventListener('paper-header-transform', function(e) {
|
||||
var d = e.detail;
|
||||
var m = d.height - d.condensedHeight;
|
||||
var scale = Math.max(0.75, (m - d.y) / (m / 0.25) + 0.75);
|
||||
|
||||
Polymer.Base.transform('scale(' + scale + ') translateZ(0)', title);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,117 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
@license
|
||||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>paper-scroll-header-panel: demo6</title>
|
||||
|
||||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
|
||||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
||||
|
||||
<link rel="import" href="../paper-scroll-header-panel.html">
|
||||
<link rel="import" href="../../paper-toolbar/paper-toolbar.html">
|
||||
<link rel="import" href="../../iron-icons/iron-icons.html">
|
||||
<link rel="import" href="../../paper-icon-button/paper-icon-button.html">
|
||||
<link rel="import" href="sample-content.html">
|
||||
|
||||
<link rel="stylesheet" href="../../paper-styles/demo.css">
|
||||
|
||||
<style is="custom-style">
|
||||
|
||||
paper-scroll-header-panel {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background-color: var(--paper-grey-200, #eee);
|
||||
|
||||
/* background for toolbar when it is at its full size */
|
||||
--paper-scroll-header-panel-full-header: {
|
||||
background-image: url(images/bg6.jpg);
|
||||
};
|
||||
|
||||
/* background for toolbar when it is condensed */
|
||||
--paper-scroll-header-panel-condensed-header: {
|
||||
background-image: url(images/bg2.jpg);
|
||||
};
|
||||
}
|
||||
|
||||
paper-toolbar.tall {
|
||||
/* custom toolbar height */
|
||||
height: 256px;
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
paper-toolbar.tall .title {
|
||||
font-size: 40px;
|
||||
margin-left: 60px;
|
||||
|
||||
-webkit-transform-origin: left center;
|
||||
transform-origin: left center;
|
||||
|
||||
/* Issue #15 */
|
||||
isolation: isolate;
|
||||
}
|
||||
|
||||
paper-toolbar.tall iron-icon {
|
||||
margin: 0 8px;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- By default condensedHeaderHeight is 1/3 of the header's height. Here
|
||||
we want to set the condensed header's height to be 64px. -->
|
||||
<paper-scroll-header-panel condenses header-height="256" condensed-header-height="64">
|
||||
|
||||
<paper-toolbar class="tall">
|
||||
|
||||
<paper-icon-button icon="arrow-back"></paper-icon-button>
|
||||
<div class="flex"></div>
|
||||
<paper-icon-button icon="search"></paper-icon-button>
|
||||
<paper-icon-button icon="more-vert"></paper-icon-button>
|
||||
<div class="bottom title">Title</div>
|
||||
|
||||
</paper-toolbar>
|
||||
|
||||
<div class="content">
|
||||
|
||||
<sample-content size="100"></sample-content>
|
||||
|
||||
</div>
|
||||
|
||||
</paper-scroll-header-panel>
|
||||
|
||||
<script>
|
||||
|
||||
// custom transformation: scale header's title
|
||||
var title = document.querySelector('.title');
|
||||
addEventListener('paper-header-transform', function(e) {
|
||||
var d = e.detail;
|
||||
var m = d.height - d.condensedHeight;
|
||||
var scale = Math.max(0.75, (m - d.y) / (m / 0.25) + 0.75);
|
||||
|
||||
Polymer.Base.transform('scale(' + scale + ') translateZ(0)', title);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,120 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
@license
|
||||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>paper-scroll-header-panel: demo7</title>
|
||||
|
||||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
|
||||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
||||
|
||||
<link rel="import" href="../paper-scroll-header-panel.html">
|
||||
<link rel="import" href="../../paper-toolbar/paper-toolbar.html">
|
||||
<link rel="import" href="../../iron-icons/iron-icons.html">
|
||||
<link rel="import" href="../../paper-icon-button/paper-icon-button.html">
|
||||
<link rel="import" href="../../iron-media-query/iron-media-query.html">
|
||||
<link rel="import" href="sample-content.html">
|
||||
|
||||
<link rel="stylesheet" href="../../paper-styles/demo.css">
|
||||
|
||||
<style is="custom-style">
|
||||
|
||||
paper-scroll-header-panel {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background-color: var(--paper-grey-200, #eee);
|
||||
|
||||
/* background for toolbar when it is at its full size */
|
||||
--paper-scroll-header-panel-full-header: {
|
||||
background-image: url(images/bg2.jpg);
|
||||
};
|
||||
|
||||
/* background for toolbar when it is condensed */
|
||||
--paper-scroll-header-panel-condensed-header: {
|
||||
background-color: var(--google-yellow-500, #f4b400);
|
||||
};
|
||||
}
|
||||
|
||||
paper-toolbar.tall {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
paper-toolbar.tall .title {
|
||||
font-size: 40px;
|
||||
margin-left: 60px;
|
||||
|
||||
-webkit-transform-origin: left center;
|
||||
transform-origin: left center;
|
||||
|
||||
/* Issue #15 */
|
||||
isolation: isolate;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<paper-scroll-header-panel condenses>
|
||||
|
||||
<paper-toolbar class="tall">
|
||||
|
||||
<paper-icon-button icon="arrow-back"></paper-icon-button>
|
||||
<div class="flex"></div>
|
||||
<paper-icon-button icon="search"></paper-icon-button>
|
||||
<paper-icon-button icon="more-vert"></paper-icon-button>
|
||||
<div class="bottom indent title">Title</div>
|
||||
|
||||
</paper-toolbar>
|
||||
|
||||
<div class="content">
|
||||
|
||||
<h3>Resize window to toggle between fixed header and scrolled header</h3>
|
||||
<sample-content size="100"></sample-content>
|
||||
|
||||
</div>
|
||||
|
||||
</paper-scroll-header-panel>
|
||||
|
||||
<iron-media-query id="mquery" query="min-width: 600px"></iron-media-query>
|
||||
|
||||
<script>
|
||||
|
||||
// toggle fixed header based on screen size
|
||||
var panel = document.querySelector('paper-scroll-header-panel');
|
||||
var mquery = document.querySelector('#mquery');
|
||||
mquery.addEventListener('query-matches-changed', function() {
|
||||
panel.fixed = mquery.queryMatches;
|
||||
});
|
||||
|
||||
// custom transformation: scale header's title
|
||||
var title = document.querySelector('.title');
|
||||
addEventListener('paper-header-transform', function(e) {
|
||||
var d = e.detail;
|
||||
var m = d.height - d.condensedHeight;
|
||||
var scale = Math.max(0.75, (m - d.y) / (m / 0.25) + 0.75);
|
||||
|
||||
Polymer.Base.transform('scale(' + scale + ') translateZ(0)', title);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,126 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
@license
|
||||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>paper-scroll-header-panel: demo8</title>
|
||||
|
||||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
|
||||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
||||
|
||||
<link rel="import" href="../paper-scroll-header-panel.html">
|
||||
<link rel="import" href="../../paper-toolbar/paper-toolbar.html">
|
||||
<link rel="import" href="../../iron-icon/iron-icon.html">
|
||||
<link rel="import" href="../../iron-icons/iron-icons.html">
|
||||
<link rel="import" href="../../paper-icon-button/paper-icon-button.html">
|
||||
<link rel="import" href="sample-content.html">
|
||||
|
||||
<link rel="stylesheet" href="../../paper-styles/demo.css">
|
||||
|
||||
<style is="custom-style">
|
||||
|
||||
paper-scroll-header-panel {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background-color: var(--paper-grey-200, #eee);
|
||||
|
||||
/* background for toolbar when it is at its full size */
|
||||
--paper-scroll-header-panel-full-header: {
|
||||
background-image: url(images/bg9.jpg);
|
||||
};
|
||||
|
||||
/* background for toolbar when it is condensed */
|
||||
--paper-scroll-header-panel-condensed-header: {
|
||||
background-color: var(--paper-purple-800, #6a1b9a);
|
||||
};
|
||||
}
|
||||
|
||||
paper-toolbar {
|
||||
/* custom toolbar height */
|
||||
height: 256px;
|
||||
background-color: transparent;
|
||||
overflow: visible;
|
||||
}
|
||||
|
||||
paper-toolbar paper-icon-button {
|
||||
margin: 0 8px;
|
||||
}
|
||||
|
||||
.bottom-text {
|
||||
-webkit-transform: translateZ(0);
|
||||
transform: translateZ(0);
|
||||
|
||||
font-size: 20px;
|
||||
padding-bottom: 10px;
|
||||
}
|
||||
|
||||
.subtitle {
|
||||
padding-top: 4px;
|
||||
font-size: 16px;
|
||||
color: #ccc;
|
||||
}
|
||||
|
||||
.bookmark {
|
||||
position: absolute;
|
||||
bottom: -24px;
|
||||
right: 24px;
|
||||
fill: #4285f4;
|
||||
height: 48px;
|
||||
width: 48px;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 16px 10px 16px 50px;
|
||||
}
|
||||
|
||||
.indent {
|
||||
margin-left: 60px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- `keepCondensedHeader` makes the condensed header to not scroll away -->
|
||||
<paper-scroll-header-panel condenses keep-condensed-header header-height="256" condensed-header-height="140">
|
||||
|
||||
<paper-toolbar>
|
||||
|
||||
<paper-icon-button icon="arrow-back"></paper-icon-button>
|
||||
<div class="flex"></div>
|
||||
<paper-icon-button icon="thumb-up"></paper-icon-button>
|
||||
<paper-icon-button icon="mail"></paper-icon-button>
|
||||
|
||||
<div class="bottom indent bottom-text" self-end>
|
||||
<div>Lorem ipsum dolor sit amet</div>
|
||||
<div class="subtitle">Iisque perfecto dissentiet cum et</div>
|
||||
</div>
|
||||
|
||||
<iron-icon class="bottom bookmark" icon="bookmark"></iron-icon>
|
||||
|
||||
</paper-toolbar>
|
||||
|
||||
<div class="content">
|
||||
|
||||
<sample-content size="100"></sample-content>
|
||||
|
||||
</div>
|
||||
|
||||
</paper-scroll-header-panel>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,108 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
@license
|
||||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>paper-scroll-header-panel: demo9</title>
|
||||
|
||||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
|
||||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
||||
|
||||
<link rel="import" href="../paper-scroll-header-panel.html">
|
||||
<link rel="import" href="../../iron-icon/iron-icon.html">
|
||||
<link rel="import" href="../../iron-icons/iron-icons.html">
|
||||
<link rel="import" href="../../iron-icons/av-icons.html">
|
||||
<link rel="import" href="../../paper-toolbar/paper-toolbar.html">
|
||||
<link rel="import" href="../../paper-input/paper-input.html">
|
||||
<link rel="import" href="sample-content.html">
|
||||
|
||||
<link rel="stylesheet" href="../../paper-styles/demo.css">
|
||||
|
||||
|
||||
<style is="custom-style">
|
||||
|
||||
paper-scroll-header-panel {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background-color: var(--paper-grey-200, #eee);
|
||||
|
||||
/* background for toolbar when it is at its full size */
|
||||
--paper-scroll-header-panel-full-header: {
|
||||
background-image: url(images/bg9.jpg);
|
||||
};
|
||||
|
||||
/* background for toolbar when it is condensed */
|
||||
--paper-scroll-header-panel-condensed-header: {
|
||||
background-color: transparent;
|
||||
};
|
||||
}
|
||||
|
||||
paper-toolbar {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
.field {
|
||||
background-color: #fff;
|
||||
border: 1px solid #eee;
|
||||
box-shadow: 0 2px 5px 0 rgba(0, 0, 0, 0.26);
|
||||
height: 40px;
|
||||
}
|
||||
|
||||
.field iron-icon {
|
||||
color: var(--google-grey-700);
|
||||
fill: var(--google-grey-700);
|
||||
margin: 0 8px;
|
||||
}
|
||||
|
||||
.field input {
|
||||
font-size: 20px;
|
||||
outline: 0;
|
||||
border: none;
|
||||
margin-left: 20px;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<!-- Instead of using 1/3 of the header's height, we want to manually set the
|
||||
condensed header's height to 64px -->
|
||||
<paper-scroll-header-panel condenses condensed-header-height="64">
|
||||
|
||||
<paper-toolbar class="medium-tall">
|
||||
|
||||
<div class="flex center horizontal layout bottom field">
|
||||
<iron-icon icon="menu"></iron-icon>
|
||||
<input class="flex">
|
||||
<iron-icon icon="av:mic"></iron-icon>
|
||||
</div>
|
||||
</paper-toolbar>
|
||||
|
||||
<div class="content">
|
||||
|
||||
<sample-content size="100"></sample-content>
|
||||
|
||||
</div>
|
||||
|
||||
</paper-scroll-header-panel>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 95 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 79 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 321 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 175 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 174 KiB |
@@ -0,0 +1,113 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
@license
|
||||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<title>paper-scroll-header-panel: demo4</title>
|
||||
|
||||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
||||
<meta name="mobile-web-app-capable" content="yes">
|
||||
<meta name="apple-mobile-web-app-capable" content="yes">
|
||||
|
||||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
||||
|
||||
<link rel="import" href="../paper-scroll-header-panel.html">
|
||||
<link rel="import" href="../../paper-toolbar/paper-toolbar.html">
|
||||
<link rel="import" href="../../iron-icons/iron-icons.html">
|
||||
<link rel="import" href="../../paper-icon-button/paper-icon-button.html">
|
||||
<link rel="import" href="sample-content.html">
|
||||
|
||||
<link rel="stylesheet" href="../../paper-styles/demo.css">
|
||||
|
||||
<style is="custom-style">
|
||||
|
||||
paper-scroll-header-panel {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
background-color: var(--paper-grey-200, #eee);
|
||||
|
||||
/* background for toolbar when it is at its full size */
|
||||
--paper-scroll-header-panel-full-header: {
|
||||
background-image: url(images/bg6.jpg);
|
||||
};
|
||||
|
||||
/* background for toolbar when it is condensed */
|
||||
--paper-scroll-header-panel-condensed-header: {
|
||||
background-color: var(--paper-deep-orange-500, #ff5722);
|
||||
};
|
||||
}
|
||||
|
||||
paper-toolbar.tall {
|
||||
background-color: transparent;
|
||||
}
|
||||
|
||||
paper-toolbar.tall .title {
|
||||
font-size: 40px;
|
||||
margin-left: 60px;
|
||||
|
||||
-webkit-transform-origin: left center;
|
||||
transform-origin: left center;
|
||||
|
||||
/* Issue #15 */
|
||||
isolation: isolate;
|
||||
}
|
||||
|
||||
paper-toolbar.tall iron-icon {
|
||||
margin: 0 8px;
|
||||
}
|
||||
|
||||
.content {
|
||||
padding: 8px;
|
||||
}
|
||||
|
||||
</style>
|
||||
|
||||
</head>
|
||||
<body unresolved>
|
||||
|
||||
<paper-scroll-header-panel condenses>
|
||||
|
||||
<paper-toolbar class="tall">
|
||||
|
||||
<paper-icon-button icon="arrow-back"></paper-icon-button>
|
||||
<div class="flex"></div>
|
||||
<paper-icon-button icon="search"></paper-icon-button>
|
||||
<paper-icon-button icon="more-vert"></paper-icon-button>
|
||||
<div class="bottom title">Title</div>
|
||||
|
||||
</paper-toolbar>
|
||||
|
||||
<div class="content">
|
||||
|
||||
<sample-content size="100"></sample-content>
|
||||
|
||||
</div>
|
||||
|
||||
</paper-scroll-header-panel>
|
||||
|
||||
<script>
|
||||
|
||||
// custom transformation: scale header's title
|
||||
var title = document.querySelector('.title');
|
||||
addEventListener('paper-header-transform', function(e) {
|
||||
var d = e.detail;
|
||||
var m = d.height - d.condensedHeight;
|
||||
var scale = Math.max(0.75, (m - d.y) / (m / 0.25) + 0.75);
|
||||
|
||||
Polymer.Base.transform('scale(' + scale + ') translateZ(0)', title);
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,42 @@
|
||||
<!--
|
||||
@license
|
||||
Copyright (c) 2014 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
<dom-module name="lorem-ipsum" attributes="paragraphs">
|
||||
<script>
|
||||
|
||||
(function() {
|
||||
var strings = [
|
||||
'Lorem ipsum dolor sit amet, per in nusquam nominavi periculis, sit elit oportere ea, id minim maiestatis incorrupte duo. Dolorum verterem ad ius, his et nullam verterem. Eu alia debet usu, an doming tritani est. Vix ad ponderum petentium suavitate, eum eu tempor populo, graece sententiae constituam vim ex. Cu torquatos reprimique neglegentur nec, voluptua periculis has ut, at eos discere deleniti sensibus.',
|
||||
'Ut labores minimum atomorum pro. Laudem tibique ut has. No nam ipsum lorem aliquip, accumsan quaerendum ei usu. Maiestatis vituperatoribus qui at, ne suscipit volutpat tractatos nam. Nonumy semper mollis vis an, nam et harum detracto. An pri dolor percipitur, vel maluisset disputationi te.',
|
||||
'Fugit adolescens vis et, ei graeci forensibus sed. Denique argumentum comprehensam ei vis, id has facete accommodare, quo scripta utroque id. Autem nullam doming ad eam, te nam dicam iriure periculis. Quem vocent veritus eu vis, nam ut hinc idque feugait.',
|
||||
'Convenire definiebas scriptorem eu cum. Sit dolor dicunt consectetuer no, in vix nisl velit, duo ridens abhorreant delicatissimi ut. Pro ei libris omnium scripserit, natum volumus propriae no eam. Suscipit pericula explicari sed ei, te usu iudicabit forensibus efficiantur. Has quot dicam animal id.',
|
||||
'Ea duis bonorum nec, falli paulo aliquid ei eum. Cu mei vide viris gloriatur, at populo eripuit sit. Idque molestiae duo ne. Qui id tempor accusamus sadipscing. His odio feugait et. Ne vis vide labitur, eu corpora appareat interpretaris mel.',
|
||||
'Usu eu novum principes, vel quodsi aliquip ea. Labore mandamus persequeris id mea, has eripuit neglegentur id, illum noster nec in. Ea nam quod quando cetero, per qualisque tincidunt in. Qui ne meliore commune voluptatibus, qui justo labores no. Et dicat cotidieque eos, vis homero legere et, eam timeam nominavi in. Pri dicam option placerat an, cu qui aliquam adipiscing signiferumque. Vis euismod accusamus no, soluta vocibus ei cum.',
|
||||
'Has at minim mucius aliquam, est id tempor laoreet. Ius officiis convenire ex, in vim iuvaret patrioque similique, veritus detraxit sed ad. Mel no admodum abhorreant cotidieque, et duo possim postulant, consul convenire adolescens cu mel. Duo in decore soleat doming. Fabellas interpretaris eos at. No cum unum novum dicit.',
|
||||
'Pro saepe pertinax ei, ad pri animal labores suscipiantur. Modus commodo minimum eum te, vero utinam assueverit per eu, zril oportere suscipiantur pri te. Partem percipitur deterruisset ad sea, at eam suas luptatum dissentiunt. No error alienum pro, erant senserit ex mei, pri semper alterum no. Ut habemus menandri vulputate mea. Feugiat verterem ut sed. Dolores maiestatis id per.',
|
||||
'Detracto suavitate repudiandae no eum. Id adhuc minim soluta nam, novum denique ad eum. At mucius malorum meliore his, te ferri tritani cum, eu mel legendos ocurreret. His te ludus aperiam malorum, mundi nominati deseruisse pro ne, mel discere intellegat in. Vero dissentiunt quo in, vel cu meis maiestatis adversarium. In sit summo nostrum petentium, ea vix amet nullam minimum, ornatus sensibus theophrastus ex nam.',
|
||||
'Iisque perfecto dissentiet cum et, sit ut quot mandamus, ut vim tibique splendide instructior. Id nam odio natum malorum, tibique copiosae expetenda mel ea. Mea melius malorum ut. Ut nec tollit vocent timeam. Facer nonumy numquam id his, munere salutatus consequuntur eum et, eum cotidieque definitionem signiferumque id. Ei oblique graecis patrioque vis, et probatus dignissim inciderint vel. Sed id paulo erroribus, autem semper accusamus in mel.'
|
||||
];
|
||||
|
||||
Polymer('lorem-ipsum', {
|
||||
|
||||
paragraphs: 0,
|
||||
|
||||
paragraphsChanged: function() {
|
||||
this.innerHTML = '';
|
||||
for (var i = 0; i < this.paragraphs; i++) {
|
||||
this.innerHTML += '<p>' + strings[Math.floor(Math.random() * strings.length)] + '</p>';
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
})();
|
||||
|
||||
</script>
|
||||
</dom-module>
|
||||
@@ -0,0 +1,72 @@
|
||||
<!--
|
||||
@license
|
||||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
<dom-module id="sample-content">
|
||||
<template>
|
||||
<div id="content"></div>
|
||||
</template>
|
||||
</dom-module>
|
||||
|
||||
<script>
|
||||
|
||||
(function() {
|
||||
|
||||
var strings = [
|
||||
'Lorem ipsum dolor sit amet, per in nusquam nominavi periculis, sit elit oportere ea.',
|
||||
'Ut labores minimum atomorum pro. Laudem tibique ut has.',
|
||||
'Fugit adolescens vis et, ei graeci forensibus sed.',
|
||||
'Convenire definiebas scriptorem eu cum. Sit dolor dicunt consectetuer no.',
|
||||
'Ea duis bonorum nec, falli paulo aliquid ei eum.',
|
||||
'Usu eu novum principes, vel quodsi aliquip ea.',
|
||||
'Has at minim mucius aliquam, est id tempor laoreet.',
|
||||
'Pro saepe pertinax ei, ad pri animal labores suscipiantur.',
|
||||
'Detracto suavitate repudiandae no eum. Id adhuc minim soluta nam.',
|
||||
'Iisque perfecto dissentiet cum et, sit ut quot mandamus, ut vim tibique splendide instructior.',
|
||||
'Id nam odio natum malorum, tibique copiosae expetenda mel ea.',
|
||||
'Cu mei vide viris gloriatur, at populo eripuit sit.',
|
||||
'Modus commodo minimum eum te, vero utinam assueverit per eu.',
|
||||
'No nam ipsum lorem aliquip, accumsan quaerendum ei usu.'
|
||||
];
|
||||
|
||||
function randomString() {
|
||||
return strings[Math.floor(Math.random() * strings.length)];
|
||||
}
|
||||
|
||||
function randomLetter() {
|
||||
return String.fromCharCode(65 + Math.floor(Math.random() * 26));
|
||||
}
|
||||
|
||||
Polymer({
|
||||
is: 'sample-content',
|
||||
|
||||
properties: {
|
||||
size: {
|
||||
type: Number,
|
||||
value: 0,
|
||||
observer: 'sizeChanged'
|
||||
}
|
||||
},
|
||||
|
||||
sizeChanged: function() {
|
||||
var html = '';
|
||||
for (var i = 0; i < this.size; i++) {
|
||||
html +=
|
||||
'<div style="border: 1px solid #bebebe; padding: 16px; margin: 16px; border-radius: 5px; background-color: #fff; color: #555;">' +
|
||||
'<div style="display: inline-block; height: 64px; width: 64px; border-radius: 50%; background: #ddd; line-height: 64px; font-size: 30px; color: #666; text-align: center;">'+ randomLetter() + '</div>' +
|
||||
'<div style="font-size: 22px; padding: 8px 0 16px; color: #888;">' + randomString() + '</div>' +
|
||||
'<div style="font-size: 16px; padding-bottom: 8px;">' + randomString() + '</div>' +
|
||||
'<div style="font-size: 12px;">' + randomString() + '</div>' +
|
||||
'<div style="font-size: 12px;">' + randomString() + '</div>' +
|
||||
'</div>';
|
||||
this.$.content.innerHTML = html;
|
||||
}
|
||||
}
|
||||
});
|
||||
})();
|
||||
</script>
|
||||
@@ -0,0 +1,41 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<!-- Generator: Adobe Illustrator 17.1.0, SVG Export Plug-In . SVG Version: 6.00 Build 0) -->
|
||||
<!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN" "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd">
|
||||
<svg version="1.1" xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" x="0px" y="0px"
|
||||
viewBox="0 0 225 126" enable-background="new 0 0 225 126" xml:space="preserve">
|
||||
<g id="background" display="none">
|
||||
<rect display="inline" fill="#B0BEC5" width="225" height="126"/>
|
||||
</g>
|
||||
<g id="label">
|
||||
</g>
|
||||
<g id="art">
|
||||
<circle cx="170.6" cy="28.5" r="4"/>
|
||||
<circle cx="170.6" cy="58.5" r="4"/>
|
||||
<rect x="170" y="29" width="2" height="30"/>
|
||||
<path d="M163,102H73V24h90V102z M75,100h86V26H75V100z"/>
|
||||
<rect x="74" y="62" width="88" height="2"/>
|
||||
<g id="ic_x5F_add_x0D_">
|
||||
</g>
|
||||
<g>
|
||||
<polygon points="74,59.6 74,62.5 74.5,63 77.4,63 "/>
|
||||
<polygon points="74,51.9 74,54.7 82.3,63 85.1,63 "/>
|
||||
<polygon points="74,44.1 74,46.9 90.1,63 92.9,63 "/>
|
||||
<polygon points="74,36.3 74,39.2 97.8,63 100.7,63 "/>
|
||||
<polygon points="74,28.6 74,31.4 105.6,63 108.4,63 "/>
|
||||
<polygon points="78.2,25 75.4,25 113.4,63 116.2,63 "/>
|
||||
<polygon points="86,25 83.1,25 121.1,63 124,63 "/>
|
||||
<polygon points="93.7,25 90.9,25 128.9,63 131.7,63 "/>
|
||||
<polygon points="101.5,25 98.7,25 136.7,63 139.5,63 "/>
|
||||
<polygon points="109.2,25 106.4,25 144.4,63 147.2,63 "/>
|
||||
<polygon points="117,25 114.2,25 152.2,63 155,63 "/>
|
||||
<polygon points="124.8,25 122,25 160,63 162,63 162,62.2 "/>
|
||||
<polygon points="132.5,25 129.7,25 162,57.3 162,54.5 "/>
|
||||
<polygon points="140.3,25 137.5,25 162,49.5 162,46.7 "/>
|
||||
<polygon points="148.1,25 145.2,25 162,41.8 162,38.9 "/>
|
||||
<polygon points="155.8,25 153,25 162,34 162,31.2 "/>
|
||||
<polygon points="162,26.2 162,25 160.8,25 "/>
|
||||
</g>
|
||||
</g>
|
||||
<g id="Guides">
|
||||
</g>
|
||||
</svg>
|
||||
|
After Width: | Height: | Size: 1.9 KiB |
@@ -0,0 +1,28 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
@license
|
||||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
|
||||
<meta charset="utf-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
|
||||
<title>paper-scroll-header-panel</title>
|
||||
|
||||
<script src="../webcomponentsjs/webcomponents-lite.js"></script>
|
||||
<link rel="import" href="../iron-component-page/iron-component-page.html">
|
||||
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<iron-component-page></iron-component-page>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,455 @@
|
||||
<!--
|
||||
@license
|
||||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE.txt
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS.txt
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS.txt
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS.txt
|
||||
-->
|
||||
|
||||
<link rel="import" href="../polymer/polymer.html">
|
||||
<link rel="import" href="../iron-resizable-behavior/iron-resizable-behavior.html">
|
||||
|
||||
<!--
|
||||
`paper-scroll-header-panel` contains a header section and a content section. The
|
||||
header is initially on the top part of the view but it scrolls away with the
|
||||
rest of the scrollable content. Upon scrolling slightly up at any point, the
|
||||
header scrolls back into view. This saves screen space and allows users to
|
||||
access important controls by easily moving them back to the view.
|
||||
|
||||
__Important:__ The `paper-scroll-header-panel` will not display if its parent does not have a height.
|
||||
|
||||
Using [layout classes](https://www.polymer-project.org/1.0/docs/migration.html#layout-attributes) or custom properties, you can easily make the `paper-scroll-header-panel` fill the screen
|
||||
|
||||
<body class="fullbleed layout vertical">
|
||||
<paper-scroll-header-panel class="flex">
|
||||
<paper-toolbar>
|
||||
<div>Hello World!</div>
|
||||
</paper-toolbar>
|
||||
</paper-scroll-header-panel>
|
||||
</body>
|
||||
|
||||
or, if you would prefer to do it in CSS, just give `html`, `body`, and `paper-scroll-header-panel` a height of 100%:
|
||||
|
||||
html, body {
|
||||
height: 100%;
|
||||
margin: 0;
|
||||
}
|
||||
paper-scroll-header-panel {
|
||||
height: 100%;
|
||||
}
|
||||
|
||||
`paper-scroll-header-panel` works well with `paper-toolbar` but can use any element
|
||||
that represents a header by adding a `paper-header` class to it.
|
||||
|
||||
<paper-scroll-header-panel>
|
||||
<paper-toolbar>Header</paper-toolbar>
|
||||
<div>Content goes here...</div>
|
||||
</paper-scroll-header-panel>
|
||||
|
||||
Styling scroll-header-panel:
|
||||
|
||||
To change background for toolbar when it is at its full size:
|
||||
|
||||
paper-scroll-header-panel {
|
||||
--paper-scroll-header-panel-full-header: {
|
||||
background-color: red;
|
||||
};
|
||||
}
|
||||
|
||||
To change the background for toolbar when it is condensed:
|
||||
|
||||
paper-scroll-header-panel {
|
||||
--paper-scroll-header-panel-condensed-header: {
|
||||
background-color: #f4b400;
|
||||
};
|
||||
}
|
||||
|
||||
@group Paper Element
|
||||
@element paper-scroll-header-panel
|
||||
@demo demo/index.html
|
||||
@hero hero.svg
|
||||
-->
|
||||
|
||||
<dom-module id="paper-scroll-header-panel">
|
||||
|
||||
<style>
|
||||
:host {
|
||||
display: block;
|
||||
position: relative;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#mainContainer {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
bottom: 0;
|
||||
left: 0;
|
||||
-moz-box-sizing: border-box;
|
||||
box-sizing: border-box;
|
||||
-webkit-overflow-scrolling: touch;
|
||||
overflow-x: hidden;
|
||||
overflow-y: auto;
|
||||
-webkit-transform: translateZ(0);
|
||||
transform: translateZ(0);
|
||||
}
|
||||
|
||||
#headerContainer {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
right: 0;
|
||||
left: 0;
|
||||
}
|
||||
|
||||
.bg-container {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
overflow: hidden;
|
||||
}
|
||||
|
||||
#headerBg {
|
||||
@apply(--paper-scroll-header-panel-full-header);
|
||||
}
|
||||
|
||||
#condensedHeaderBg {
|
||||
@apply(--paper-scroll-header-panel-condensed-header);
|
||||
}
|
||||
|
||||
#headerBg, #condensedHeaderBg {
|
||||
position: absolute;
|
||||
top: 0;
|
||||
left: 0;
|
||||
width: 100%;
|
||||
height: 100%;
|
||||
background-repeat: no-repeat;
|
||||
background-size: cover;
|
||||
background-position: center center;
|
||||
}
|
||||
|
||||
#condensedHeaderBg {
|
||||
opacity: 0;
|
||||
}
|
||||
</style>
|
||||
<template>
|
||||
<div id="mainContainer">
|
||||
<content id="mainContent" select=":not(paper-toolbar):not(.paper-header)"></content>
|
||||
</div>
|
||||
<div id="headerContainer">
|
||||
<div class="bg-container">
|
||||
<div id="condensedHeaderBg"></div>
|
||||
<div id="headerBg"></div>
|
||||
</div>
|
||||
<content id="headerContent" select="paper-toolbar, .paper-header"></content>
|
||||
</div>
|
||||
</template>
|
||||
</dom-module>
|
||||
|
||||
<script>
|
||||
(function() {
|
||||
|
||||
'use strict';
|
||||
|
||||
Polymer({
|
||||
|
||||
/**
|
||||
* Fired when the content has been scrolled.
|
||||
*
|
||||
* @event content-scroll
|
||||
*/
|
||||
|
||||
/**
|
||||
* Fired when the header is transformed.
|
||||
*
|
||||
* @event paper-header-transform
|
||||
*/
|
||||
|
||||
is: 'paper-scroll-header-panel',
|
||||
|
||||
behaviors: [
|
||||
Polymer.IronResizableBehavior
|
||||
],
|
||||
|
||||
properties: {
|
||||
|
||||
/**
|
||||
* If true, the header's height will condense to `condensedHeaderHeight`
|
||||
* as the user scrolls down from the top of the content area.
|
||||
*/
|
||||
condenses: {
|
||||
type: Boolean,
|
||||
value: false,
|
||||
observer: '_condensesChanged'
|
||||
},
|
||||
|
||||
/**
|
||||
* If true, no cross-fade transition from one background to another.
|
||||
*/
|
||||
noDissolve: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
|
||||
/**
|
||||
* If true, the header doesn't slide back in when scrolling back up.
|
||||
*/
|
||||
noReveal: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
|
||||
/**
|
||||
* If true, the header is fixed to the top and never moves away.
|
||||
*/
|
||||
fixed: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
|
||||
/**
|
||||
* If true, the condensed header is always shown and does not move away.
|
||||
*/
|
||||
keepCondensedHeader: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
|
||||
/**
|
||||
* The height of the header when it is at its full size.
|
||||
*
|
||||
* By default, the height will be measured when it is ready. If the height
|
||||
* changes later the user needs to either set this value to reflect the
|
||||
* new height or invoke `measureHeaderHeight()`.
|
||||
*/
|
||||
headerHeight: {
|
||||
type: Number,
|
||||
value: 0
|
||||
},
|
||||
|
||||
/**
|
||||
* The height of the header when it is condensed.
|
||||
*
|
||||
* By default, `condensedHeaderHeight` is 1/3 of `headerHeight` unless
|
||||
* this is specified.
|
||||
*/
|
||||
condensedHeaderHeight: {
|
||||
type: Number,
|
||||
value: 0
|
||||
},
|
||||
|
||||
/**
|
||||
* By default, the top part of the header stays when the header is being
|
||||
* condensed. Set this to true if you want the top part of the header
|
||||
* to be scrolled away.
|
||||
*/
|
||||
scrollAwayTopbar: {
|
||||
type: Boolean,
|
||||
value: false
|
||||
},
|
||||
|
||||
_headerMargin: {
|
||||
type: Number
|
||||
},
|
||||
|
||||
_prevScrollTop: {
|
||||
type: Number
|
||||
},
|
||||
|
||||
_y: {
|
||||
type: Number
|
||||
}
|
||||
|
||||
},
|
||||
|
||||
observers: [
|
||||
'_setup(_headerMargin, headerHeight, fixed)',
|
||||
'_headerHeightChanged(headerHeight, condensedHeaderHeight)',
|
||||
'_condensedHeaderHeightChanged(headerHeight, condensedHeaderHeight)'
|
||||
],
|
||||
|
||||
listeners: {
|
||||
'iron-resize': 'measureHeaderHeight'
|
||||
},
|
||||
|
||||
ready: function() {
|
||||
this.async(this.measureHeaderHeight, 5);
|
||||
this._scrollHandler = this._scroll.bind(this);
|
||||
this.scroller.addEventListener('scroll', this._scrollHandler);
|
||||
},
|
||||
|
||||
detached: function() {
|
||||
this.scroller.removeEventListener('scroll', this._scrollHandler);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the header element.
|
||||
*
|
||||
* @property header
|
||||
* @type Object
|
||||
*/
|
||||
get header() {
|
||||
return Polymer.dom(this.$.headerContent).getDistributedNodes()[0];
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the content element.
|
||||
*
|
||||
* @property content
|
||||
* @type Object
|
||||
*/
|
||||
get content() {
|
||||
return Polymer.dom(this.$.mainContent).getDistributedNodes()[0];
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the scrollable element.
|
||||
*
|
||||
* @property scroller
|
||||
* @type Object
|
||||
*/
|
||||
get scroller() {
|
||||
return this.$.mainContainer;
|
||||
},
|
||||
|
||||
/**
|
||||
* Invoke this to tell `paper-scroll-header-panel` to re-measure the header's
|
||||
* height.
|
||||
*
|
||||
* @method measureHeaderHeight
|
||||
*/
|
||||
measureHeaderHeight: function() {
|
||||
var header = this.header;
|
||||
if (header && header.offsetHeight) {
|
||||
this.headerHeight = header.offsetHeight;
|
||||
}
|
||||
},
|
||||
|
||||
_headerHeightChanged: function() {
|
||||
if (!this.condensedHeaderHeight) {
|
||||
// assume condensedHeaderHeight is 1/3 of the headerHeight
|
||||
this.condensedHeaderHeight = this.headerHeight * 1 / 3;
|
||||
}
|
||||
},
|
||||
|
||||
_condensedHeaderHeightChanged: function() {
|
||||
if (this.headerHeight) {
|
||||
this._headerMargin = this.headerHeight - this.condensedHeaderHeight;
|
||||
}
|
||||
},
|
||||
|
||||
_condensesChanged: function() {
|
||||
if (this.condenses) {
|
||||
this._scroll();
|
||||
} else {
|
||||
// reset transform/opacity set on the header
|
||||
this._condenseHeader(null);
|
||||
}
|
||||
},
|
||||
|
||||
_setup: function() {
|
||||
var s = this.scroller.style;
|
||||
s.paddingTop = this.fixed ? '' : this.headerHeight + 'px';
|
||||
|
||||
s.top = this.fixed ? this.headerHeight + 'px' : '';
|
||||
|
||||
if (this.fixed) {
|
||||
this._transformHeader(null);
|
||||
} else {
|
||||
this._scroll();
|
||||
}
|
||||
},
|
||||
|
||||
_transformHeader: function(y) {
|
||||
var s = this.$.headerContainer.style;
|
||||
this._translateY(s, -y);
|
||||
|
||||
if (this.condenses) {
|
||||
this._condenseHeader(y);
|
||||
}
|
||||
|
||||
this.fire('paper-header-transform', {y: y, height: this.headerHeight,
|
||||
condensedHeight: this.condensedHeaderHeight});
|
||||
},
|
||||
|
||||
_condenseHeader: function(y) {
|
||||
var reset = (y === null);
|
||||
|
||||
// adjust top bar in paper-header so the top bar stays at the top
|
||||
if (!this.scrollAwayTopbar && this.header.$ && this.header.$.topBar) {
|
||||
this._translateY(this.header.$.topBar.style,
|
||||
reset ? null : Math.min(y, this._headerMargin));
|
||||
}
|
||||
// transition header bg
|
||||
var hbg = this.$.headerBg.style;
|
||||
if (!this.noDissolve) {
|
||||
hbg.opacity = reset ? '' : (this._headerMargin - y) / this._headerMargin;
|
||||
}
|
||||
// adjust header bg so it stays at the center
|
||||
this._translateY(hbg, reset ? null : y / 2);
|
||||
// transition condensed header bg
|
||||
if (!this.noDissolve) {
|
||||
var chbg = this.$.condensedHeaderBg.style;
|
||||
chbg = this.$.condensedHeaderBg.style;
|
||||
chbg.opacity = reset ? '' : y / this._headerMargin;
|
||||
|
||||
// adjust condensed header bg so it stays at the center
|
||||
this._translateY(chbg, reset ? null : y / 2);
|
||||
}
|
||||
},
|
||||
|
||||
_translateY: function(s, y) {
|
||||
var t = (y === null) ? '' : 'translate3d(0, ' + y + 'px, 0)';
|
||||
setTransform(s, t);
|
||||
},
|
||||
|
||||
/** @param {Event=} event */
|
||||
_scroll: function(event) {
|
||||
if (!this.header) {
|
||||
return;
|
||||
}
|
||||
|
||||
var sTop = this.scroller.scrollTop;
|
||||
|
||||
this._y = this._y || 0;
|
||||
this._prevScrollTop = this._prevScrollTop || 0;
|
||||
|
||||
var y = Math.min(this.keepCondensedHeader ?
|
||||
this._headerMargin : this.headerHeight, Math.max(0,
|
||||
(this.noReveal ? sTop : this._y + sTop - this._prevScrollTop)));
|
||||
|
||||
if (this.condenses && this._prevScrollTop >= sTop && sTop > this._headerMargin) {
|
||||
y = Math.max(y, this._headerMargin);
|
||||
}
|
||||
|
||||
if (!event || !this.fixed && y !== this._y) {
|
||||
this._transformHeader(y);
|
||||
}
|
||||
|
||||
this._prevScrollTop = Math.max(sTop, 0);
|
||||
this._y = y;
|
||||
|
||||
if (event) {
|
||||
this.fire('content-scroll', {target: this.scroller}, {cancelable: false});
|
||||
}
|
||||
}
|
||||
|
||||
});
|
||||
|
||||
//determine proper transform mechanizm
|
||||
if (document.documentElement.style.transform !== undefined) {
|
||||
var setTransform = function(style, string) {
|
||||
style.transform = string;
|
||||
}
|
||||
} else {
|
||||
var setTransform = function(style, string) {
|
||||
style.webkitTransform = string;
|
||||
}
|
||||
}
|
||||
|
||||
})();
|
||||
|
||||
</script>
|
||||
@@ -0,0 +1,112 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
@license
|
||||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<title>paper-scroll-header-panel test</title>
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0">
|
||||
|
||||
<script src="../../webcomponentsjs/webcomponents-lite.js"></script>
|
||||
<script src="../../web-component-tester/browser.js"></script>
|
||||
<script src="../../test-fixture/test-fixture-mocha.js"></script>
|
||||
|
||||
<link rel="import" href="../paper-scroll-header-panel.html">
|
||||
<link rel="import" href="../demo/sample-content.html">
|
||||
<link rel="import" href="../../paper-toolbar/paper-toolbar.html">
|
||||
<link rel="import" href="../../test-fixture/test-fixture.html">
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<test-fixture id="trivialProgress">
|
||||
<template>
|
||||
<paper-scroll-header-panel>
|
||||
<paper-toolbar>
|
||||
</paper-toolbar>
|
||||
<div class="content">
|
||||
<sample-content size="100"></sample-content>
|
||||
</div>
|
||||
</paper-scroll-header-panel>
|
||||
</template>
|
||||
</test-fixture>
|
||||
|
||||
<script>
|
||||
|
||||
suite('<paper-scroll-header-panel>', function() {
|
||||
var scrollHeaderPanel, toolbar, content;
|
||||
|
||||
setup(function() {
|
||||
scrollHeaderPanel = fixture('trivialProgress');
|
||||
|
||||
toolbar = Polymer.dom(scrollHeaderPanel).querySelector('paper-toolbar');
|
||||
content = Polymer.dom(scrollHeaderPanel).querySelector('.content');
|
||||
});
|
||||
|
||||
test('check default', function() {
|
||||
assert.equal(scrollHeaderPanel.header, toolbar);
|
||||
assert.equal(scrollHeaderPanel.content, content);
|
||||
assert.equal(scrollHeaderPanel.condenses, false);
|
||||
assert.equal(scrollHeaderPanel.noReveal, false);
|
||||
assert.equal(scrollHeaderPanel.fixed, false);
|
||||
assert.typeOf(scrollHeaderPanel.scroller, 'object');
|
||||
assert.equal(scrollHeaderPanel.keepCondensedHeader, false);
|
||||
assert.equal(scrollHeaderPanel.keepCondensedHeader, false);
|
||||
assert.equal(scrollHeaderPanel.headerHeight, toolbar.offsetHeight);
|
||||
assert.equal(scrollHeaderPanel.condensedHeaderHeight, toolbar.offsetHeight * 1 / 3);
|
||||
});
|
||||
|
||||
test('condensation', function(done) {
|
||||
var top1 = toolbar.getBoundingClientRect().top;
|
||||
|
||||
scrollHeaderPanel.condenses = true;
|
||||
scrollHeaderPanel.headerHeight = 150;
|
||||
scrollHeaderPanel.condensedHeaderHeight = 50;
|
||||
scrollHeaderPanel.scroller.scrollTop = 300;
|
||||
|
||||
flush(function() {
|
||||
assert.notEqual(top1, toolbar.getBoundingClientRect().top)
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
test('paper-header-transform event', function(done) {
|
||||
scrollHeaderPanel.condenses = false;
|
||||
scrollHeaderPanel.headerHeight = scrollHeaderPanel.headerHeight || 150;
|
||||
|
||||
scrollHeaderPanel.addEventListener('paper-header-transform', function(e) {
|
||||
assert.typeOf(e.detail.y, 'number');
|
||||
assert.equal(e.detail.height, scrollHeaderPanel.headerHeight);
|
||||
assert.equal(e.detail.condensedHeight, scrollHeaderPanel.condensedHeaderHeight);
|
||||
done();
|
||||
});
|
||||
|
||||
flush(function() {
|
||||
scrollHeaderPanel.scroller.scrollTop = 300;
|
||||
});
|
||||
});
|
||||
|
||||
test('content-scroll event', function(done) {
|
||||
scrollHeaderPanel.condenses = false;
|
||||
|
||||
scrollHeaderPanel.addEventListener('content-scroll', function(e) {
|
||||
assert.equal(e.detail.target, scrollHeaderPanel.scroller);
|
||||
done();
|
||||
});
|
||||
|
||||
flush(function() {
|
||||
scrollHeaderPanel.scroller.scrollTop = 300;
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
</script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,25 @@
|
||||
<!doctype html>
|
||||
<!--
|
||||
@license
|
||||
Copyright (c) 2015 The Polymer Project Authors. All rights reserved.
|
||||
This code may only be used under the BSD style license found at http://polymer.github.io/LICENSE
|
||||
The complete set of authors may be found at http://polymer.github.io/AUTHORS
|
||||
The complete set of contributors may be found at http://polymer.github.io/CONTRIBUTORS
|
||||
Code distributed by Google as part of the polymer project is also
|
||||
subject to an additional IP rights grant found at http://polymer.github.io/PATENTS
|
||||
-->
|
||||
<html>
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, minimum-scale=1.0, initial-scale=1.0, user-scalable=yes">
|
||||
<title>Tests</title>
|
||||
<script src="../../web-component-tester/browser.js"></script>
|
||||
</head>
|
||||
<body>
|
||||
<script>
|
||||
WCT.loadSuites([
|
||||
'basic.html'
|
||||
]);
|
||||
</script>
|
||||
</body>
|
||||
</html>
|
||||
Reference in New Issue
Block a user