- From: Tab Atkins Jr.. via cvs-syncmail <cvsmail@w3.org>
- Date: Wed, 18 Jan 2012 02:14:01 +0000
- To: public-css-commits@w3.org
Update of /sources/public/csswg/css3-flexbox In directory hutz:/tmp/cvs-serv19460 Added Files: flex-order-example.html Log Message: Add some support files for the upcoming commit. --- NEW FILE: flex-order-example.html --- <!DOCTYPE html> <title>test</title> <ul class=tabs> <li>one</li> <li>two</li> <li class=current>three</li> <li>four</li> </ul> <div class=cards> <div>I am the content connected to the first tab.</div> <div>I am the content connected to the second tab.</div> <div class=current>I am the content connected to the third tab.</div> <div>I am the content connected to the fourth tab.</div> </div> <style> .tabs { display: -moz-box; display: -webkit-box; display: -webkit-flexbox; display: flexbox; padding: 0 0 0 2px; margin: 1em 0 0; } .tabs > li { display: block; background: white; color: gray; padding: 2px 5px 0; margin: 0 1px; border-radius: .5em .5em 0 0; border: 2px solid; border-bottom: none; cursor: pointer; -moz-box-ordinal-group: 2; -webkit-box-ordinal-group: 2; -webkit-flex-order: 2; flex-order: 2; } .tabs > li.current { color: black; border-bottom: 2px solid transparent; position: relative; bottom: -2px; -moz-box-ordinal-group: 1; -webkit-box-ordinal-group: 1; -webkit-flex-order: 1; flex-order: 1; } .cards { border: 2px solid; width: 500px; } .cards > * { min-height: 50px; padding: 1em; } .cards > :not(.current) { display: none; } </style> <script> function find(sel) { return document.querySelector(sel); } function findAll(sel) { return [].slice.call(document.querySelectorAll(sel)); } var tabs = findAll('.tabs > *'); var cards = findAll('.cards > *'); tabs.forEach(function(el) { el.onclick = function(e) { findAll('.current').forEach(function(el) { el.classList.remove('current'); }); el.classList.add('current'); var index = tabs.indexOf(el); cards[index].classList.add('current'); }; }); </script>
Received on Wednesday, 18 January 2012 02:14:04 UTC