Tooltip/Accordion
How do I make an tooltip/accordion?
What is a tooltip/accordion? How do you make a tooltip/accordion? This script and codes were developed by Alex Rodrigues on 13 August 2022, Saturday.
Tooltip/Accordion - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Tooltip/Accordion</title> <script src="http://s.codepen.io/assets/libs/modernizr.js" type="text/javascript"></script>
<meta name="viewport" content="width=device-width"> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div class="wrap"> <p class="heading">Easy tooltip that changes to an accordion on touch devices</p> <ul class="info"> <li class="info-item">I'm a list Item 1 <div class="tooltip"> <p></p> </div> </li> <li class="info-item">I'm a list Item 2 <div class="tooltip"> <p></p> </div> </li> <li class="info-item">I'm a list Item 3 <div class="tooltip"> <p></p> </div> </li> <li class="info-item">I'm a list Item 4 <div class="tooltip"> <p></p> </div> </li> </ul>
</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>
Tooltip/Accordion - Script Codes CSS Codes
@import url(http://fonts.googleapis.com/css?family=Droid+Serif:400,400italic|Montserrat:400,700);
html, body, div, span, applet, object, iframe,
h1, h2, h3, h4, h5, h6, p, blockquote, pre,
a, abbr, acronym, address, big, cite, code,
del, dfn, em, img, ins, kbd, q, s, samp,
small, strike, strong, sub, sup, tt, var,
b, u, i, center,
dl, dt, dd, ol, ul, li,
fieldset, form, label, legend,
table, caption, tbody, tfoot, thead, tr, th, td,
article, aside, canvas, details, embed,
figure, figcaption, footer, header, hgroup,
menu, nav, output, ruby, section, summary,
time, mark, audio, video { margin: 0; padding: 0; border: 0; font: inherit; font-size: 100%; vertical-align: baseline;
}
html { line-height: 1;
}
ol, ul { list-style: none;
}
table { border-collapse: collapse; border-spacing: 0;
}
caption, th, td { text-align: left; font-weight: normal; vertical-align: middle;
}
q, blockquote { quotes: none;
}
q:before, q:after, blockquote:before, blockquote:after { content: ""; content: none;
}
a img { border: none;
}
article, aside, details, figcaption, figure, footer, header, hgroup, main, menu, nav, section, summary { display: block;
}
* { box-sizing: border-box;
}
/* VARIABLES & MIXINS */
body { font-family: "Droid Serif", serif; line-height: 1.5;
}
.wrap { width: 100%; margin: 5% auto; text-align: right; max-width: 400px;
}
.heading { padding: 1em; text-align: center; font-size: 1.25em;
}
.info-item { padding: 1em; position: relative;
}
.info-item:before { content: "?"; float: right; margin-left: .5em; border: 1px solid; font-size: 85%; border-radius: 1em; padding: 0 0.25em; font-weight: bold;
}
.tooltip { background: #fff; border: 2px solid blue; padding: 1em; top: 0; right: 2em; display: none;
}
.active-tooltip .tooltip { position: absolute; display: block; top: 0; right: 2em;
}
.active-accordion .tooltip { display: block;
}
.tooltip p:before { font-family: "Montserrat", sans-serif; content: "I'm A tooltip"; display: block;
}
@media screen and (max-width: 600px) { .tooltip p:before { content: "I'm An Accordion"; }
}
Tooltip/Accordion - Script Codes JS Codes
if(!Modernizr.touch) { $('.info-item').hover(function() { $(this).toggleClass('active-tooltip'); });
}
else{ $('.info-item').click(function() { $(this).toggleClass('active-accordion'); });
}
Developer | Alex Rodrigues |
Username | alex_rodrigues |
Uploaded | August 13, 2022 |
Rating | 3 |
Size | 3,467 Kb |
Views | 26,312 |
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 |
Animated Bar Graphs | 3,919 Kb |
Responsive Table-less Shopping Cart | 6,637 Kb |
Learning FlexBox | 2,821 Kb |
Jquery Scroll test | 3,879 Kb |
A Pen by alex rodrigues | 3,920 Kb |
WIP - Checkout Flow Steps Progress mobile concept | 3,960 Kb |
SA_testing | 2,188 Kb |
Mobile Menu Concept WIP | 4,592 Kb |
Playing with Grid | 2,224 Kb |
Animate delay Sass Mixin | 3,050 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 |
Em Test | Rodesco | 1,784 Kb |
Reviews and Ratings Star | Zbnmstry | 1,591 Kb |
A Pen by Alex Edwards | Exards | 8,218 Kb |
Hovers with popups | Zacharyolson | 2,380 Kb |
Review test | Otro_user_gil | 4,054 Kb |
Gears | Synvox | 3,278 Kb |
Image Hover | Johnheiner | 3,409 Kb |
Css3 slide | Nakome | 3,190 Kb |
SVG Transform vs CSS Transform | AmeliaBR | 4,175 Kb |
Count checked checkboxes with jQuery | Mestika | 2,343 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!