layout | title | stylesheets |
---|---|---|
home |
Quickstart |
/css/homepage.css |
{{site.project_title}}'s collection of elements are ready to drop in your page. To use a component, simply import it, then use it.
<link rel="import" href="google-map.html"> <link rel="import" href="google-map-directions.html"><map-directions start="San Francisco" end="Mountain View" travelMode="DRIVING"></map-directions> <google-map id="map" zoom="14" showCenterMarker></google-map>
<script> var gmap = document.querySelector('#map'); gmap.addEventListener('map-ready', function(e) { var dirs = document.querySelector('map-directions'); dirs.map = gmap.map; }); </script>
{{site.project_title}} allows you to declaratively build custom elements using <polymer-element>
. The DOM and CSS of your element are encapsulated using Shadow DOM. Inside {{site.project_title}} you can use features like two-way data binding and declarative event handlers.
<link rel="import" href="../polymer/polymer.html"><polymer-element name="hello-element" attributes="name"> <template> <link rel="stylesheet" href="element.css"> <div on-click="{%raw%}{{sayHi}}{%endraw%}">Hello, <b id="name">{%raw%}{{name}}{%endraw%}</b>!
},
sayHi: function() {
alert('Hi!' + this.name);
},
});
</script> </polymer-element> {% highlight html %} #name { color: red; } @media only screen and (min-width: 580px) { #name { letter-spacing: 5px; } } {% endhighlight %} {% highlight html %}
<script src="platform.js"></script> {% endhighlight %}