Initializing...
Liveweave
expand_more
home
Home
data_object
CSS Explorer
arrow_outward
Palette
Color Explorer
arrow_outward
Polyline
Graphics Editor
arrow_outward
outbox_alt
Generative AI
arrow_outward
build
Tools
expand_more
restart_alt
Load base template
post_add
Generate Lorem ipsum...
code
Format HTML
code_blocks
Format CSS
data_object
Format JavaScript
library_add
Library
expand_more
A
Algolia JS
Animate CSS
Apex Charts JS
B
Bulma CSS
Bootstrap
C
Chart JS
Chartist
Create JS
D
D3
Dojo
F
Foundation
Fullpage JS
G
Granim JS
Google Charts
H
Halfmoon
J
jQuery
M
Materialize
Moment JS
Masonry JS
Milligram CSS
P
Pure CSS
Primer CSS
Popper JS
Pattern CSS
Picnic CSS
R
React JS
Raphael JS
Raisin CSS
S
Semantic UI
Skeleton CSS
Spectre CSS
Tachyons CSS
T
Tailwind
Three JS
U
UI Kit
Vis JS
W
Water CSS
download
Download
expand_more
developer_mode
Download as HTML
folder_zip
Download as .ZIP
cloud_upload
Save
account_circle
Login
settings
Settings
expand_more
14
px
Live mode
Night mode
Line number
Mini map
Word wrap
sync_alt
Reset Settings
smart_display
Run
<!DOCTYPE html> <html> <head> <script type="text/javascript" src="http://code.jquery.com/jquery-1.9.1.js"></script> </head> <body> <table class="fixed"> <col width="50px" /> <col width="50px" /> <col width="50px" /> <tr> <th><p id="11">Div 1</p></th> <th><p id="22">Div 2</p></th> <th><p id="33">Div 3</p></th> <th id ="xx"><p>x</p></th> </tr> <tr> <td id="1">111</td> <td id="2">222</td> <td id="3">333</td> </tr> </table> <br> <div class="tot">Total: <p id="tot"></p></div> <div class="holder"><div id="per"></div></div> </body> </html>
body { font-family: "Arial"; } p { opacity: 0; } td { background: red; padding: 4px; border-radius: 3px; } table { text-align: center; border-spacing:10px; width: 210px; } #per { height: 100%; width: 0px; background: green; } .holder { width: 200px; height: 10px; background: lightgrey; float: left; margin: 4px; } #xx { color: white; } .tot { float: left; } .hover { background-color: darkred; } .selected { background-color: #FF6A6A; } table.fixed { table-layout:fixed; } table.fixed td { overflow: hidden; } table.fixed th { overflow: hidden; }
$( "td" ).hover( function() { $( this ).addClass('hover'); }, function() { $( this ).removeClass('hover'); } ); var one = 0 var two = 0 var thr = 0 $('#1').click(function(){ if (one == 1) { $( "#11" ).animate({opacity: 0}, 150 ); $( "#1" ).removeClass('selected'); one = 0; } else { $( "#11" ).animate({opacity: 1}, 150 ); $( "#1" ).addClass('selected'); one = 1; } show(); }); $('#2').click(function(){ if (two == 1) { $( "#22" ).animate({opacity: 0}, 150 ); $( "#2" ).removeClass('selected'); two = 0; } else { $( "#22" ).animate({opacity: 1}, 150 ); $( "#2" ).addClass('selected'); two = 1; } show(); }); $('#3').click(function(){ if (thr == 1) { $( "#33" ).animate({opacity: 0}, 150 ); $( "#3" ).removeClass('selected'); thr = 0; } else { $( "#33" ).animate({opacity: 1}, 150 ); $( "#3" ).addClass('selected'); thr = 1; } show(); }); function show() { var sum = one + two + thr if (sum == 0) { var per = "1%" } else { var per = String(100*(sum/3)) + "%" } $( "#per" ).animate({width: per}, 150 ); }