Responsive SVG thermometer
How do I make an responsive svg thermometer?
What is a responsive svg thermometer? How do you make a responsive svg thermometer? This script and codes were developed by Rafael Abensur on 12 September 2022, Monday.
Responsive SVG thermometer - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Responsive SVG thermometer</title> <meta name="viewport" content="width=device-width, initial-scale=1"> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/normalize/5.0.0/normalize.min.css"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="thermometer--very-low"> <span>You are<strong></strong></span> <div class="glass"> <div class="liquid"></div> <svg class="ruler"> <rect x="0px" y="0" width="20%" height="100%" fill="url(#ticks--very-low)" rx="2"/> <rect x="20%" y="0" width="20%" height="100%" fill="url(#ticks--low)" rx="2"/> <rect x="40%" y="0" width="20%" height="100%" fill="url(#ticks--moderate)" rx="2"/> <rect x="60%" y="0" width="20%" height="100%" fill="url(#ticks--high)" rx="2"/> <rect x="80%" y="0" width="20%" height="100%" fill="url(#ticks--very-high)" rx="2"/> <defs> <pattern id="ticks--very-low" class="ticks--very-low" width="60px" height="100%" patternUnits="userSpaceOnUse" x="0"> <line x1="1px" x2="1px" y2="6px" /> <line x1="12px" x2="12px" y2="6px" /> <line x1="24px" x2="24px" y2="6px" /> <line x1="36px" x2="36px" y2="6px" /> <line x1="48px" x2="48px" y2="10px" /> </pattern> <pattern id="ticks--low" class="ticks--low" width="60px" height="100%" patternUnits="userSpaceOnUse" x="0"> <line x1="1px" x2="1px" y2="6px" /> <line x1="12px" x2="12px" y2="6px" /> <line x1="24px" x2="24px" y2="6px" /> <line x1="36px" x2="36px" y2="6px" /> <line x1="48px" x2="48px" y2="10px" /> </pattern> <pattern id="ticks--moderate" class="ticks--moderate" width="60px" height="100%" patternUnits="userSpaceOnUse" x="0"> <line x1="1px" x2="1px" y2="6px" /> <line x1="12px" x2="12px" y2="6px" /> <line x1="24px" x2="24px" y2="6px" /> <line x1="36px" x2="36px" y2="6px" /> <line x1="48px" x2="48px" y2="10px" /> </pattern> <pattern id="ticks--high" class="ticks--high" width="60px" height="100%" patternUnits="userSpaceOnUse" x="0"> <line x1="1px" x2="1px" y2="6px" /> <line x1="12px" x2="12px" y2="6px" /> <line x1="24px" x2="24px" y2="6px" /> <line x1="36px" x2="36px" y2="6px" /> <line x1="48px" x2="48px" y2="10px" /> </pattern> <pattern id="ticks--very-high" class="ticks--very-high" width="60px" height="100%" patternUnits="userSpaceOnUse" x="0"> <line x1="1px" x2="1px" y2="6px" /> <line x1="12px" x2="12px" y2="6px" /> <line x1="24px" x2="24px" y2="6px" /> <line x1="36px" x2="36px" y2="6px" /> <line x1="48px" x2="48px" y2="10px" /> </pattern> </defs> </svg> </div>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Responsive SVG thermometer - Script Codes CSS Codes
body { background: #454545;
}
.thermometer, .thermometer--very-low, .thermometer--low, .thermometer--moderate, .thermometer--high, .thermometer--very-high { max-width: 80%; margin: 2rem auto;
}
.thermometer span, .thermometer--very-low span, .thermometer--low span, .thermometer--moderate span, .thermometer--high span, .thermometer--very-high span { font-family: Verdana; font-size: 1rem; color: #ccc; min-width: 100%; text-align: center; display: block; margin-bottom: 1.25rem;
}
.thermometer .liquid, .thermometer--very-low .liquid, .thermometer--low .liquid, .thermometer--moderate .liquid, .thermometer--high .liquid, .thermometer--very-high .liquid { display: block; width: 100%; height: 1.275rem; border: 1px solid #d2d2d2; border-radius: 10px; margin: .25rem auto 0; position: relative;
}
.thermometer .liquid:before, .thermometer--very-low .liquid:before, .thermometer--low .liquid:before, .thermometer--moderate .liquid:before, .thermometer--high .liquid:before, .thermometer--very-high .liquid:before { position: absolute; content: ""; height: 70%; left: 3px; top: 14%; border-radius: 10px; -webkit-transition: width .3s ease; transition: width .3s ease;
}
.thermometer .ruler, .thermometer--very-low .ruler, .thermometer--low .ruler, .thermometer--moderate .ruler, .thermometer--high .ruler, .thermometer--very-high .ruler { height: .625rem; width: 100%; margin-left: 2px;
}
.thermometer .ruler .ticks--very-low line, .thermometer--very-low .ruler .ticks--very-low line, .thermometer--low .ruler .ticks--very-low line, .thermometer--moderate .ruler .ticks--very-low line, .thermometer--high .ruler .ticks--very-low line, .thermometer--very-high .ruler .ticks--very-low line, .thermometer .ruler .ticks--low line, .thermometer--very-low .ruler .ticks--low line, .thermometer--low .ruler .ticks--low line, .thermometer--moderate .ruler .ticks--low line, .thermometer--high .ruler .ticks--low line, .thermometer--very-high .ruler .ticks--low line, .thermometer .ruler .ticks--moderate line, .thermometer--very-low .ruler .ticks--moderate line, .thermometer--low .ruler .ticks--moderate line, .thermometer--moderate .ruler .ticks--moderate line, .thermometer--high .ruler .ticks--moderate line, .thermometer--very-high .ruler .ticks--moderate line, .thermometer .ruler .ticks--high line, .thermometer--very-low .ruler .ticks--high line, .thermometer--low .ruler .ticks--high line, .thermometer--moderate .ruler .ticks--high line, .thermometer--high .ruler .ticks--high line, .thermometer--very-high .ruler .ticks--high line, .thermometer .ruler .ticks--very-high line, .thermometer--very-low .ruler .ticks--very-high line, .thermometer--low .ruler .ticks--very-high line, .thermometer--moderate .ruler .ticks--very-high line, .thermometer--high .ruler .ticks--very-high line, .thermometer--very-high .ruler .ticks--very-high line { stroke-width: 2px; shape-rendering: crispEdges;
}
.thermometer .ruler .ticks--very-low, .thermometer--very-low .ruler .ticks--very-low, .thermometer--low .ruler .ticks--very-low, .thermometer--moderate .ruler .ticks--very-low, .thermometer--high .ruler .ticks--very-low, .thermometer--very-high .ruler .ticks--very-low { stroke: #249AA7;
}
.thermometer .ruler .ticks--low, .thermometer--very-low .ruler .ticks--low, .thermometer--low .ruler .ticks--low, .thermometer--moderate .ruler .ticks--low, .thermometer--high .ruler .ticks--low, .thermometer--very-high .ruler .ticks--low { stroke: #B8E1F2;
}
.thermometer .ruler .ticks--moderate, .thermometer--very-low .ruler .ticks--moderate, .thermometer--low .ruler .ticks--moderate, .thermometer--moderate .ruler .ticks--moderate, .thermometer--high .ruler .ticks--moderate, .thermometer--very-high .ruler .ticks--moderate { stroke: #ABD25E;
}
.thermometer .ruler .ticks--high, .thermometer--very-low .ruler .ticks--high, .thermometer--low .ruler .ticks--high, .thermometer--moderate .ruler .ticks--high, .thermometer--high .ruler .ticks--high, .thermometer--very-high .ruler .ticks--high { stroke: #F8C830;
}
.thermometer .ruler .ticks--very-high, .thermometer--very-low .ruler .ticks--very-high, .thermometer--low .ruler .ticks--very-high, .thermometer--moderate .ruler .ticks--very-high, .thermometer--high .ruler .ticks--very-high, .thermometer--very-high .ruler .ticks--very-high { stroke: #F1594A;
}
.thermometer--very-low strong { color: #249AA7;
}
.thermometer--very-low strong:before { content: " freezing";
}
.thermometer--very-low .liquid:before { background: #249AA7; width: 10%;
}
.thermometer--low strong { color: #B8E1F2;
}
.thermometer--low strong:before { content: " cold";
}
.thermometer--low .liquid:before { background: #B8E1F2; width: 30%;
}
.thermometer--moderate strong { color: #ABD25E;
}
.thermometer--moderate strong:before { content: " ok";
}
.thermometer--moderate .liquid:before { background: #ABD25E; width: 50%;
}
.thermometer--high strong { color: #F8C830;
}
.thermometer--high strong:before { content: " hot";
}
.thermometer--high .liquid:before { background: #F8C830; width: 70%;
}
.thermometer--very-high strong { color: #F1594A;
}
.thermometer--very-high strong:before { content: " blazing";
}
.thermometer--very-high .liquid:before { background: #F1594A; width: 99%;
}
Responsive SVG thermometer - Script Codes JS Codes
var perfis = ['very-low', 'low', 'moderate', 'high', 'very-high'], el = $('div[class^=thermometer]'), random = '';
setInterval(function() { random = perfis[Math.floor(Math.random() * perfis.length)]; el.removeClass().addClass('thermometer--'+random);
}, 3500);
Developer | Rafael Abensur |
Username | abensur |
Uploaded | September 12, 2022 |
Rating | 4 |
Size | 3,711 Kb |
Views | 89,056 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Roundout Ribbon | 2,907 Kb |
Food Seasons | 6,522 Kb |
Tesseract experiments | 3,557 Kb |
D3.js Brazil Economic Underwater | 4,368 Kb |
New Pen Template | 1,233 Kb |
D3.js with CSS sprites | 9,304 Kb |
Amadurou Logo Animation | 3,208 Kb |
Chart tooltip example | 2,757 Kb |
Isocubes | 4,776 Kb |
Pocker Mortys dataviz | 13,940 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Rows with image hover effect | Amit-webdesigner | 12,875 Kb |
SCSS Unit Conversion | Jakob-e | 8,210 Kb |
Custom checkbox example | Capelo | 3,495 Kb |
Dragonball Dragon Radar | DouglasGlover | 2,157 Kb |
Weather App | Kw7oe | 3,162 Kb |
Loading... | Adamjacob | 2,384 Kb |
Blog Concept 2 | JGallardo | 2,994 Kb |
Apex Calculator | Michaelwnelson | 2,370 Kb |
CSS3 Form | Tusharbandal | 1,836 Kb |
Basic jQuery Filter list | Mtedwards | 2,464 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!