Max-height transition
How do I make an max-height transition?
Quick demo showing how to animate the height of selected containers.. What is a max-height transition? How do you make a max-height transition? This script and codes were developed by António Capelo on 15 December 2022, Thursday.
Max-height transition - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>max-height transition</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="main-container"> <h1 class="title">Show stuff</h1> <input type="checkbox" data-text="opt1"/> Option #1 <input type="checkbox" data-text="opt2"/> Option #2 <div class="extra-stuff-container hide" id="opt1"> <div class="extra-stuff"> some text </div> </div> <div class="extra-stuff-container hide" id="opt2"> <div class="extra-stuff opt2"> even more text </div> </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>
Max-height transition - Script Codes CSS Codes
html { height: 100%;
}
input { margin-bottom: 20px;
}
body { height: 100%; font-family: Arial; background: url(https://subtlepatterns.com/patterns/stardust.png);
}
.main-container { width: 500px; border-radius: 4px; padding: 10px; background: #D6D6D6; position: absolute; top: 50%; left: 50%; -webkit-transform: translate(-50%, -50%); transform: translate(-50%, -50%);
}
.main-container .title { margin: 0; padding: 10px;
}
.main-container .extra-stuff-container { background: url(https://subtlepatterns.com/patterns/stardust.png); color: ghostwhite; max-height: 100px; overflow: hidden; -webkit-transition: all 0.8s ease-out; transition: all 0.8s ease-out;
}
.main-container .extra-stuff-container .extra-stuff { padding: 10px;
}
.main-container .extra-stuff-container.hide { max-height: 0px;
}
Max-height transition - Script Codes JS Codes
window.onload = function () { var check1, check2; check1 = $('#opt1'); $('input').on('change', function(e) { var text = $(this).data('text'); console.log(text); if (text) { $(this).is(":checked") ? $('#'+text).removeClass('hide') : $('#'+text).addClass('hide') ; } })
}
Developer | António Capelo |
Username | capelo |
Uploaded | December 15, 2022 |
Rating | 3 |
Size | 2,643 Kb |
Views | 4,048 |
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 |
Analog Clock | 2,896 Kb |
Background cover | 3,735 Kb |
Menu with following underline | 2,648 Kb |
Brainerd scroller | 3,165 Kb |
React Boilerplate | 1,457 Kb |
AngularJS Modal Factory | 3,839 Kb |
Room | 5,196 Kb |
Gif as page background | 3,521 Kb |
Camera click | 1,963 Kb |
Donut Chart example - MorrisJS | 2,385 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 |
Lazy Load for Background Images | The_ruther4d | 2,977 Kb |
Get third wednesday | Wojtek1150 | 2,691 Kb |
Clock with full screen background | Owebboy | 2,415 Kb |
Octopus Bar iPad App Interactions | Davidkpiano | 6,735 Kb |
Buttons with style | Chbymnky | 2,082 Kb |
Video mute | Leon9208 | 2,131 Kb |
A Pen by Mohomed Anees | Mohomedanees | 12,597 Kb |
Twitch TV | Natester13 | 4,488 Kb |
A Pen by Ben Babics | Benbabics | 2,957 Kb |
ABVI Menu Discarded | Overdrivemachines | 3,607 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!