YUI().use("html5-details", function (Y) {
var details = new Y.HTML5.Details();
details.enable();
});
/*
* Details
* JavaScript enabler for HTML5 Details Element
* developer's website: http://wemakesites.net/#!/web-dev
* developer's twitter: https://twitter.com/#!/wemakesitesnet
* developer's blog http://acidmartin.wordpress.com/
**/
YUI.add("html5-details", function(Y) {
function Details() {
Details.superclass.constructor.apply(this, arguments);
}
var OPEN = "open";
Y.extend(Details, Y.Base, {
enable: function() {
if (!(OPEN in document.createElement("details"))) {
this._bind();
}
},
_bind: function() {
Y.one("body").delegate("click", function() {
var details = this.get('parentNode');
details.getAttribute(OPEN) ? details.removeAttribute(OPEN) : details.setAttribute(OPEN, OPEN);
}, "summary");
}
});
Y.namespace("HTML5").Details = Details;
}, "0.0.1", {
requires: ["base", "node", "event"]
});
.details-list,
.details-list > li
{
list-style: none outside none;
margin: 0;
padding: 0;
}
.details-list > li
{
margin: 4px 0;
}
details,
summary
{
display: block;
}
details,
summary::before
{
border-radius: 5px 5px 5px 5px;
}
details:not([open]) > div
{
display: none;
}
details[open] > div
{
display: block;
}
details > div
{
border-top: 1px dotted #333333;
font-size: 12px;
margin: 0 12px 12px;
padding: 8px 0 0;
}
details
{
border: 1px solid #e1e1e1;
box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
color: #363636;
font-family: Arial,Sans-serif;
}
summary
{
background: -moz-linear-gradient(#fafafa, #e1e1e1);
background: -webkit-linear-gradient(#fafafa, #e1e1e1);
background: -o-linear-gradient(#fafafa, #e1e1e1);
background: -ms-linear-gradient(#fafafa, #e1e1e1);
background: -linear-gradient(#fafafa, #e1e1e1);
border-radius: 5px 5px 0 0;
cursor: pointer;
font-size: 12px;
font-weight: bold;
line-height: 32px;
-moz-user-select: none;
-webkit-user-select: none;
user-select: none;
}
details[open],
details[open] summary,
summary:hover
{
background: #e1e1e1;
}
summary::before
{
color: #363636;
content: "+";
display: inline-block;
font-size: 14px;
height: 32px;
padding: 0;
text-align: center;
width: 32px;
}
details[open] summary::before
{
content: "-";
margin-top: -4px;
}
details summary::-webkit-details-marker
{
display: none;
}