JSFiddle - React, Tailwind, and code Playground
by rwaldron
HTML
<button>hide/show</button>
<ul>
</ul>
CSS
body{
font-size: 6px;
}
JavaScript
var thismanydivs = 500,
thismanyfoos = 500,
thismanylis = 8,
$div = $("<div/>"),
$divs = $(false),
content = "";
while ( thismanyfoos-- ) {
content += "foo ";
}
// add content to jango fett
$div.html(content);
while ( thismanydivs-- ) {
// cache 500 divs
$divs.push( $div.clone()[0] );
}
while ( thismanylis-- ) {
// make 8 list items
$("<li/>").appendTo("ul");
}
// append 500 divs to all 8 list items
$("li").append($divs);
$("button").click( function() {
if ( $("li:visible").length ) {
$("li").hide();
} else {
$("li").show();
}
});