Change font size using JQuery
How do I make an change font size using jquery?
What is a change font size using jquery? How do you make a change font size using jquery? This script and codes were developed by James Barnett on 04 January 2023, Wednesday.
Change font size using JQuery - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Change font size using JQuery</title> <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="container"> <h1>Resize Me</h1> <p class="font-size-label">Font Size</p> <button id="up">+</button> <p id="font-size"></p> <button id="down">-</button>
</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>
Change font size using JQuery - Script Codes CSS Codes
body { margin: 20px; }
.container { width: 500px; text-align: center;
}
h1 { height: 60px; padding: 0; margin: 0;
} p { display: inline-block; } .font-size-label { margin-right: 20px; } #font-size { margin: 0 5px; } button { width: 30px; height: 30px; }
Change font size using JQuery - Script Codes JS Codes
// When + or - buttons are clicked the font size of the h1 is increased/decreased by 2
// The max is set to 50px for this demo, the min is set by min font in the user's style sheet
function getSize() { size = $( "h1" ).css( "font-size" ); size = parseInt(size, 10); $( "#font-size" ).text( size );
}
//get inital font size
getSize();
$( "#up" ).on( "click", function() { // parse font size, if less than 50 increase font size if ((size + 2) <= 50) { $( "h1" ).css( "font-size", "+=2" ); $( "#font-size" ).text( size += 2 ); }
});
$( "#down" ).on( "click", function() { if ((size - 2) >= 12) { $( "h1" ).css( "font-size", "-=2" ); $( "#font-size" ).text( size -= 2 ); }
});
Developer | James Barnett |
Username | jamesbarnett |
Uploaded | January 04, 2023 |
Rating | 3 |
Size | 2,084 Kb |
Views | 10,120 |
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 |
CSS3 Image Wall | 2,609 Kb |
Demo of the US Map jQuery plugin | 2,298 Kb |
Progress bar for counting checkboxes | 2,268 Kb |
CSS speech bubble | 2,293 Kb |
Browser hack for Firefox | 1,520 Kb |
Floating Fixed Sidebar | 2,857 Kb |
Console.log output in codepen | 1,713 Kb |
Github-style Daily Activity Chart | 4,334 Kb |
Marquee using CSS3 keyframe animation | 2,260 Kb |
Time-based CSS Background | 2,664 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 |
Slim Grid SASS SCSS v3.2 | Thesturs | 4,709 Kb |
CSS Google Now | Jackmoran | 3,196 Kb |
FreeCodeCamp - Simon Game | Ivhed | 8,481 Kb |
Birthday Party Starter | Aussieyang | 1,629 Kb |
Hmmm... | Rk007 | 4,848 Kb |
Sort the Knowlege | Eprouver | 3,915 Kb |
Drag n Drop | Martin42 | 2,594 Kb |
TinFoil Boats | Chandralil | 4,577 Kb |
Faces SVG animation | ScavengerFrontend | 2,957 Kb |
Wave Lines | Mikehobizal | 4,023 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!