Segmented control
How do I make an segmented control?
Just like on the iPhone but not!. What is a segmented control? How do you make a segmented control? This script and codes were developed by Mitch Pruitt on 08 November 2022, Tuesday.
Segmented control - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Segmented control</title> <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css"> <style> /* NOTE: The styles were added inline because Prefixfree needs access to your styles and they must be inlined if they are on local disk! */ @import url(https://fonts.googleapis.com/css?family=Open+Sans:400,300);
.container { width: 30rem; height: 45rem; margin: 6rem auto; padding: 0 2rem 2rem; border: 1px solid; font-family: 'Open Sans', sans-serif; font-weight: 300; font-size: 1.5rem; position: relative; overflow: hidden;
}
.article-container { display: flex; position: absolute; transition: .5s all ease-in-out;
}
article { width: 30rem; flex-shrink: 0; margin-right: 4rem;
}
article:last-child { margin-right: 0;
}
.text { line-height: 2rem;
}
.numeral { margin: auto auto 2rem; width: 8rem; height: 8rem; font-size: 5rem; text-align: center; line-height: 8rem; border: 1px dotted black; border-radius: 50%;
}
.control { margin: auto; text-align: center; padding: 2rem 0 3rem;
}
input[type="radio"] { margin: 0; appearance: none; width: 3rem; height: 2rem; border: 1px solid black; border-radius: .25rem 0 0 .25rem; transition: .25s all ease-in-out;
}
input[type="radio"]:last-child { border-left: 0; border-radius: 0 .25rem .25rem 0;
}
input[type="radio"]:checked { background: black;
} </style> <script src="https://cdnjs.cloudflare.com/ajax/libs/prefixfree/1.0.7/prefixfree.min.js"></script>
</head>
<body> <section class="container"> <form class="control"> <input type="radio" name="view" value="left"><input type="radio" name="view" value="right"> </form> <div class="article-container"> <article class="left"> <p class="numeral">1</p> <p class="text">Locavore hashtag synth, plaid gluten-free direct trade tousled. Twee church-key meggings, kogi High Life cornhole craft beer gastropub locavore paleo Truffaut. Post-ironic pug photo booth, cornhole chillwave beard Wes Anderson fashion axe leggings McSweeney's paleo meh Thundercats. Fingerstache heirloom jean shorts, occupy letterpress messenger bag keffiyeh Marfa pickled readymade bitters farm-to-table ennui. American Apparel pork belly iPhone, Vice mustache heirloom tote bag jean shorts four loko lomo.</p> </article> <article class="right"> <p class="numeral">2</p> <p class="text">Locavore hashtag synth, plaid gluten-free direct trade tousled. Twee church-key meggings, kogi High Life cornhole craft beer gastropub locavore paleo Truffaut. Post-ironic pug photo booth, cornhole chillwave beard Wes Anderson fashion axe leggings McSweeney's paleo meh Thundercats. Fingerstache heirloom jean shorts, occupy letterpress messenger bag keffiyeh Marfa pickled readymade bitters farm-to-table ennui.</p> </article> </div>
</section> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Segmented control - Script Codes CSS Codes
@import url(https://fonts.googleapis.com/css?family=Open+Sans:400,300);
.container { width: 30rem; height: 45rem; margin: 6rem auto; padding: 0 2rem 2rem; border: 1px solid; font-family: 'Open Sans', sans-serif; font-weight: 300; font-size: 1.5rem; position: relative; overflow: hidden;
}
.article-container { display: flex; position: absolute; transition: .5s all ease-in-out;
}
article { width: 30rem; flex-shrink: 0; margin-right: 4rem;
}
article:last-child { margin-right: 0;
}
.text { line-height: 2rem;
}
.numeral { margin: auto auto 2rem; width: 8rem; height: 8rem; font-size: 5rem; text-align: center; line-height: 8rem; border: 1px dotted black; border-radius: 50%;
}
.control { margin: auto; text-align: center; padding: 2rem 0 3rem;
}
input[type="radio"] { margin: 0; appearance: none; width: 3rem; height: 2rem; border: 1px solid black; border-radius: .25rem 0 0 .25rem; transition: .25s all ease-in-out;
}
input[type="radio"]:last-child { border-left: 0; border-radius: 0 .25rem .25rem 0;
}
input[type="radio"]:checked { background: black;
}
Segmented control - Script Codes JS Codes
$(document).ready(function() { $("input:radio[name='view']").click(function() { var value = $(this).val(); if (value == "right") { $(".article-container").css("left","-32rem"); } else { $(".article-container").css("left","2rem"); } });
});
Developer | Mitch Pruitt |
Username | mitchdot |
Uploaded | November 08, 2022 |
Rating | 3 |
Size | 3,759 Kb |
Views | 22,264 |
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 |
A Pen by Mitch Pruitt | 2,416 Kb |
Sooper cool article header image | 3,583 Kb |
Off-screen navigation | 5,220 Kb |
Image caption overlay | 2,107 Kb |
Animated camera focus ring | 3,305 Kb |
Image header overlay | 2,188 Kb |
ASCII triangle image overlay | 2,200 Kb |
Zoomy image rollover | 2,764 Kb |
Sample project gallery | 2,987 Kb |
Flexbox quote box | 3,441 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 |
HexMaze | Cantelope | 4,825 Kb |
Growing Root - Scroll control - CANVAS | Cjonasw | 2,342 Kb |
Form Labels | Bartuc | 2,717 Kb |
Basic HTML Slideshow | Tomhodgins | 3,386 Kb |
Ionic - Wordpress REST API starter | Superpikar | 2,961 Kb |
CardMove | Thompsonemerson | 3,699 Kb |
CSS Google Now | Jackmoran | 3,196 Kb |
Pagepilling.js | Blossk | 6,554 Kb |
Easing | GreenSock | 2,043 Kb |
Portfolio Page | KaylaMT | 1,983 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!