Skip to content

Instantly share code, notes, and snippets.

@aaizemberg
Last active January 2, 2016 03:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save aaizemberg/8246648 to your computer and use it in GitHub Desktop.
Save aaizemberg/8246648 to your computer and use it in GitHub Desktop.
simulando tabs (con botones) usando d3.js
<!DOCTYPE html>
<html>
<head>
<script src="http://d3js.org/d3.v3.min.js"></script>
<meta charset=utf-8 />
<title>tabs</title>
</head>
<body>
<button type="button" id="b1">tab 1</button>
<button type="button" id="b2">tab 2</button>
<div id='uno'>primer tab</div>
<div id='dos'>segundo tab, mejor usá --> <a href="http://jqueryui.com/tabs/">jquery tabs</a></div>
<script>
d3.select("#uno").style("display", "block");
d3.select("#dos").style("display", "none");
d3.select('#b1').on('click', function() {
d3.select("#uno").style("display", "block");
d3.select("#dos").style("display", "none");
});
d3.select('#b2').on('click', function() {
d3.select("#uno").style("display", "none");
d3.select("#dos").style("display", "block");
});
</script>
</body>
</html>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment