Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 7 months ago.
Improve this question
I have an animated circle (class="circle-ani") that grows and shrinks. However, it also causes the button (class="start-timer") to grow and shrink and the box (class="button-timer") that they're in to grow taller to accommodate the size change. How can I make it so just the circle changes size and not the rest?
Working example:
//---TIMER---//
var remainingTime = 30;
var isStopped = true;
const countContainer = document.getElementById('sec');
const renderTime = () => {
remainingTime -= 1;
countContainer.innerHTML = remainingTime;
if (remainingTime === 0) {
isStopped = true;
clearInterval(timer);
remainingTime = 30;
}
}
const startTimer = () => {
if (isStopped) {
isStopped = false;
countContainer.innerHTML = remainingTime;
timer = setInterval(renderTime, 1000);
}
}
document.getElementById('start').addEventListener('click', function() {
document.getElementById('circle').classList.add('animate');
});
const startButton = document.getElementById('start');
startButton.onclick = startTimer;
// const stopTimer = () => {
// isStopped = true;
// if (timer) {
// clearInterval(timer);
// }
// }
// const resetTimer = () => {
// isStopped = true;
// clearInterval(timer);
// clearInterval(animate);
// remainingTime = 30;
// countContainer.innerHTML = remainingTime;
// }
//---CARD OBJECTS---//
// const neck = ['Chin tuck', 'Neck extension', 'Neck towel', 'Side-to-side']
// let neckStretch1 = 'Chin tuck'
// let neckStretch2 = 'Neck extension'
// let neckStretch3 = 'Neck towel'
// let neckStretch4 = 'Side-to-side'
// const shoulder = ['Desk pec stretch', 'Doorway pec stretch', 'Overhead reach', 'W to Y', 'Cross body']
// let shoulderStretch1 = 'Desk pec stretch'
// let shoulderStretch2 = 'Doorway pec stretch'
// let shoulderStretch3 = 'Overhead reach'
// let shoulderStretch4 = 'W to Y'
// let shoulderStretch5 = 'Cross body'
// const hand = ['One-by-one', 'Wrist extensor', 'Wrist flexor']
// let handStretch1 = 'One-by-one'
// let handStretch2 = 'Wrist extensor'
// let handStretch3 = 'Wrist flexor'
// const lowBack = ['Low back rotation', 'Bending over', 'Seated knee to chest', 'Seated pelvic tilt']
// let lowBack1 = 'Low back rotation'
// let lowBack2 = 'Bending over'
// let lowBack3 = 'Seated knee to chest'
// let lowBack4 = 'Seated pelvic tilt'
// const hip = ['Kneeling psoas stretch', 'Standing psoas stretch', 'Seated glute stretch', 'Seated cross-body glute']
// let hipStretch1 = 'Kneeling psoas stretch'
// let hipStretch2 = 'Standing psoas stretch'
// let hipStretch3 = 'Seated glute stretch'
// let hipStretch4 = 'Seated cross-body glute'
// const leg = ['Seated hamstring stretch', 'Butterfly stretch', 'Standing quad stretch', 'Chair quad stretch', 'Seated abductor stretch']
// let legStretch1 = 'Seated hamgsting stretch'
// let legStretch2 = 'Butterfly stretch'
// let legStretch3 = 'Standing quad stretch'
// let legStretch4 = 'Chair quad stretch'
// let legStretch5 = 'Seated abductor stretch'
//---CARD DECK---//
mobiscroll.settings = {
theme: 'ios',
themeVariant: 'light'
};
mobiscroll.listview('.cardDeck', {
stages: [{
percent: -20,
action: function(event, inst) {
inst.move(event.target, 0);
return false;
}
}, {
percent: 20,
action: function(event, inst) {
inst.move(event.target, 0);
return false;
}
}],
actionable: false
});
// function dropdownFunction() {
// document.getElementById("myDropdown").classList.toggle('show')
// }
// function dropdownFunction() {
// var x = document.getElementById('dropdownClick')
// if (x.style.display === 'none') {
// x.style.display = 'block'
// }else {
// x.style.display = 'none'
// }
// }
// document.getElementById("menu").addEventListener("click", dropdownFunction());
// function dropdownFunction() {
// // var x = document.getElementById("dropdownClick").style
// const toggle = document.getElementById("myDropdown")
// const toggleList = document.getElementsByTagName("li");
// console.log(toggle.style.display)
// if (toggle.style.display !== null) {
// console.log("one")
// toggle.style.display = 'inline-block'
// toggleList.style.display = 'inline-block'
// }else {
// // x.display = 'none'
// console.log("two")
// }
// }
// ---BODY ICON ---//
function myFunction() {
document.getElementById("myDropdown").classList.toggle("show");
}
// Close the dropdown menu if the user clicks outside of it
window.onclick = function(event) {
if (!event.target.matches('.body-image')) {
var dropdowns = document.getElementsByClassName("dropdown-list");
showEvent = 'show';
for (var i = 0; i < dropdowns.length; i++) {
var currentElement = dropdowns[i],
currentElementAsString = dropdowns[i].toString();
if (currentElementAsString.localeCompare(showEvent)) {
currentElement.classList.remove('show');
}
}
}
}
body {
font-family: 'Gentium Book Plus', serif;
font-family: 'Noto Serif', serif;
}
/* Stylings */
html {
font-size: 62.5%;
}
.body-image {
display: none;
}
h3,
button,
a {
font-size: 1rem;
}
h2 {
/* display: flex;
flex-direction: column;
justify-content: center; */
font-size: 400%;
margin-top: -25%;
z-index: 5;
}
body {
color: rgb(247, 240, 240);
background: #8ad3b8;
/* margin: 100px 250px; */
height: 100%;
width: 99%;
display: flex;
justify-content: center;
align-content: center;
}
.main {
text-align: center;
/* align-content: center; */
margin: 4% auto;
width: 57%;
height: 65%;
background: rgba(12, 134, 85, 1);
border-radius: 20px;
border: 10px solid rgba(12, 134, 85, .4);
box-shadow: 0 0 50px rgba(12, 134, 85, 1);
min-height: 450px;
}
h1 {
margin: 0;
padding: 20px 0 0 0;
font-size: 500%;
}
h3,
section,
.start-timer {
margin: 0;
padding: 10px;
display: inline-block;
border-radius: 20px;
}
h6 {
margin: 0;
padding: 0 0 20px 0;
font-size: 10px;
}
header,
section {
margin: 0px;
}
section+section {
padding: 10px;
}
button {
background: #fe483b;
/* border-radius: 10px; */
border: 2px solid #fe483b;
}
.start-timer-section {
/* margin: 140px 0 0 0; */
outline: none;
display: flex;
flex-direction: column;
margin-top: 15%;
position: relative;
}
/* List */
.dropdown-list,
li,
a {
display: inline-block;
margin: 10px 15px 10px 10px;
color: black;
text-decoration: none;
background: #8ad3b8;
border-radius: 5px;
outline: none;
}
.dropdown-list,
li {
border-radius: 40px;
}
a {
/* display: block; height: 100%; width:100%; */
text-decoration: none;
border-radius: 5px;
color: black;
font-size: 12px;
}
.dropdown-list a:hover {
background: #fe483b;
}
/* .legs{
margin: 10px 30px 0 15px;
padding: 0 20px 0 0;
} */
/* ---THE CARD--- */
.cardDeck {
display: flex;
flex-direction: row;
justify-content: space-evenly;
padding: none;
box-shadow: 0 0 20px rgba(250, 241, 241, 0.6);
margin: 0 0 15px 0;
}
.card-directions {
border: 2px solid purple;
display: flex;
flex-direction: column;
min-height: 150px;
min-width: 35%;
}
.card-picture {
border: 2px solid yellow;
visibility: none;
min-width: 35%;
}
.button-timer {
display: flex;
flex-direction: column;
justify-content: center;
align-content: center;
border: 2px solid pink;
/* min-height: 150px; */
min-width: 15%;
flex-wrap: wrap;
}
h3 {
font-size: 15px;
}
/* ---TIMER ANIMATION--- */
body {
padding: 20px;
}
/* div.circle-ani {
transition: 4s ease;
position: relative;
width: 0px;
height: 0px;
text-align: center;
background: hsl(4, 99%, 61%, .7);
color: white;
border-radius: 100%;
padding: 40px;
overflow: hidden;
margin-bottom: -35%;
}
.animate {
transform: scale(1.9);
-webkit-transform: scale(1.9);
-ms-transform: scale(1.9);
} */
.circle-ani {
position: relative;
width: 0px;
height: 0px;
text-align: center;
background: hsl(4, 99%, 61%, .7);
color: white;
border-radius: 100%;
padding: 40px;
overflow: hidden;
margin-bottom: -35%;
}
div.animate {
/* animation properties */
animation-name: my-animation;
animation-duration: 3s;
animation-direction: alternate;
animation-iteration-count: 10;
animation-timing-function: ease-in-out;
/* other properties */
/* position: relative;
width: 0px;
height: 0px;
text-align: center;
background: hsl(4, 99%, 61%, .7);
color: white;
border-radius: 100%;
padding: 40px;
overflow: hidden;
margin-bottom: -35%; */
}
#keyframes my-animation {
from {
background-color: hsl(4, 99%, 61%, .7);
padding: 40px;
}
to {
padding: 80px;
}
}
/* ---Accessibility--- */
#media screen and (max-width: 1111px) {
body {
/* background: red; */
}
main {
width: 100%;
}
h1 {
padding: none;
margin: -7% 0 0 0;
}
h6 {
display: none;
}
.body-image {
padding: -10px;
}
.cardDeck {
display: flex;
flex-direction: row;
justify-content: space-evenly;
flex-wrap: wrap;
padding: none;
margin: 0 0 15px 0;
}
.card-directions {
min-height: auto;
display: flex;
flex-direction: row;
width: 100%;
}
.card-picture {
display: flex;
flex-direction: row;
width: 43%;
visibility: none;
/* min-height: 150px;
min-width: 150px; */
}
.button-timer {
display: flex;
flex-direction: row;
width: 43%;
min-height: 50px;
min-width: 150px;
}
.start-timer {
margin: auto;
outline: none;
}
/* .dropdown-list, li, a{
display: none;
} */
/* // --- DROPDOWN MENU--- // */
.body-image {
display: flex;
max-height: 30%;
max-width: 30%;
margin: 0;
padding: 0;
z-index: 5;
background: rgba(12, 134, 85, 1);
}
a {
cursor: pointer;
}
.dropdown {
display: flex;
justify-content: center;
align-content: center;
flex-wrap: wrap;
}
.dropdown li {
letter-spacing: .5px;
display: flex;
justify-content: center;
}
/* Dropdown Content (Hidden by Default) */
.dropdown-list {
display: none;
position: absolute;
min-width: 150px;
box-shadow: 0px 10px 16px 10px rgba(0, 0, 0, 0.5);
z-index: 1;
margin: 0;
margin-top: -35%;
padding: 0;
}
/* Links inside the dropdown */
.dropdown-list li {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: center;
margin: 0;
}
/* Change color of dropdown links on hover */
.dropdown-list a:hover {
background-color: #fe483b
}
.show {
display: block;
}
}
#media screen and (max-width: 911px) {
body {
/* background: purple; */
}
.card-picture,
.button-timer {
width: 40%;
}
}
#media screen and (max-width: 679px) {
body {
/* background: orange; */
}
.card-picture,
.button-timer {
width: 39%;
}
h1 {
font-size: 300%;
padding: 0;
}
}
#media screen and (max-width: 649px) {
body {
/* background: yellow; */
}
.card-picture,
.button-timer {
width: 36%;
}
body {
margin: 0;
}
}
#media screen and (max-width: 619px) {
body {
/* background: pink; */
}
html {
height: 60%;
margin: 0;
}
.card-picture,
.button-timer {
width: 20%;
height: 200px;
flex-direction: column;
}
.main {
width: 100%;
height: 150%;
min-height: none;
margin-left: 5px;
}
.dropdown-list {
margin: -40% 0 20% 0;
}
}
#media screen and (max-width: 430px) {
.main {
height: 155%;
}
.dropdown-list {
margin-top: -100%;
margin-bottom: 50%;
width: 40%;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Fetch a Stretch</title>
<link rel="stylesheet" type="text/css" href="style.css" media="screen" />
<link href="https://fonts.googleapis.com/css2?family=Gentium+Book+Plus&family=Noto+Serif&display=swap" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
</head>
<body>
<main class="main">
<header>
<!-- <img id = "menu" onclick = "dropdownFunction()" class="body-image" src="body.ico" alt ="body" > -->
<a onclick="myFunction()" title="Body Parts" class="body-image body-ico"><img id="menu" class="body-image" src="body.ico"> </a>
<h1>Fetch a Stretch</h1>
</header>
<section>
<h6>Welcome to moving better!</h6>
<section class="cardDeck">
<section class="card-directions">
<h3>Stretch: Lorem ipsum dolor sit.</h3>
<h3>Explanation: Lorem ipsum, dolor sit amet consectetur adipisicing elit. Tenetur, autem? Iusto itaque quae perspiciatis illo nostrum aspernatur voluptatum, libero sit provident accusantium explicabo est harum omnis quod? Amet, maiores inventore.</h3>
</section>
<section class="card-picture">
<h3>Picture:</h3>
</section>
<section class="button-timer">
<div id="circle" class="circle-ani"></div>
<h2 id="sec">30</h2>
<div class="start-timer-section">
<button onclick="start()" id='start' class="start-timer">Start Timer</button>
</div>
</section>
</section>
<span id="dropdownClick" class="dropdown">
<ul id = "myDropdown" class="dropdown-list">
<li class="neck">Neck</li>
<li class="shoulders">Shoulders</li>
<li class="hands">Hands</li>
<li class="back">Low Back</li>
<li class="hips">Hips</li>
<li class="legs">Legs</li>
</ul>
</span>
</section>
</main>
<script type="text/javascript" src="main.js"></script>
</body>
</html>
Provided that doesn't work as intended, here is the codepen for it (I hope that's okay, I'm still new to most of this) https://codepen.io/lgmunyon/pen/dymNbjQ
You have to accommodate for the circle's size - the parent div has to grow to contain the child div (the circle) the way you have them currently positioned. If you position the parent div - the card the circle is in - to be position: relative and the circle to be position: absolute you can then define exactly where the circle will sit within the card, and it will not stretch the card out.
In regards to the timer button, it has the flex property and is matching the width changes of the circle. You can remove the flex property to fix that alone, but if you use the positional changes that problem resolves itself.
section.button-timer {
position: relative;
}
div.circle-ani {
position: absolute;
top: 50px; /* An example of where to position the circle */
The animation itself is problematic. You are specifying:
#keyframes my-animation {
from {
background-color: hsl(4, 99%, 61%, .7);
padding: 40px;
}
to {
padding: 80px;
}
}
When the padding jumps the style you have set of padding: 40px; to padding: 80px; it will change the padding of the element, hence, adding more height. Remove this padding to solve your issue.
Side note: Using margin: -%; is not an efficient way to position elements. It will be very unresponsive if you do this. I added display: flex; to .circle-ani to fix the positioning of h2#sec.
//---TIMER---//
var remainingTime = 30;
var isStopped = true;
const countContainer = document.getElementById('sec');
const renderTime = () => {
remainingTime -= 1;
countContainer.innerHTML = remainingTime;
if (remainingTime === 0) {
isStopped = true;
clearInterval(timer);
remainingTime = 30;
}
}
const startTimer = () => {
if (isStopped) {
isStopped = false;
countContainer.innerHTML = remainingTime;
timer = setInterval(renderTime, 1000);
}
}
document.getElementById('start').addEventListener('click', function() {
document.getElementById('circle').classList.add('animate');
});
const startButton = document.getElementById('start');
startButton.onclick = startTimer;
// const stopTimer = () => {
// isStopped = true;
// if (timer) {
// clearInterval(timer);
// }
// }
// const resetTimer = () => {
// isStopped = true;
// clearInterval(timer);
// clearInterval(animate);
// remainingTime = 30;
// countContainer.innerHTML = remainingTime;
// }
//---CARD DECK---//
mobiscroll.settings = {
theme: 'ios',
themeVariant: 'light'
};
mobiscroll.listview('.cardDeck', {
stages: [{
percent: -20,
action: function(event, inst) {
inst.move(event.target, 0);
return false;
}
}, {
percent: 20,
action: function(event, inst) {
inst.move(event.target, 0);
return false;
}
}],
actionable: false
});
// ---BODY ICON ---//
function myFunction() {
document.getElementById("myDropdown").classList.toggle("show");
}
// Close the dropdown menu if the user clicks outside of it
window.onclick = function(event) {
if (!event.target.matches('.body-image')) {
var dropdowns = document.getElementsByClassName("dropdown-list");
showEvent = 'show';
for (var i = 0; i < dropdowns.length; i++) {
var currentElement = dropdowns[i],
currentElementAsString = dropdowns[i].toString();
if (currentElementAsString.localeCompare(showEvent)) {
currentElement.classList.remove('show');
}
}
}
}
body {
font-family: 'Gentium Book Plus', serif;
font-family: 'Noto Serif', serif;
}
/* Stylings */
html {
font-size: 62.5%;
}
.body-image {
display: none;
}
h3,
button,
a {
font-size: 1rem;
}
h2 {
/* display: flex;
flex-direction: column;
justify-content: center; */
font-size: 400%;
line-height: 1;
margin: 0;
z-index: 5;
}
body {
color: rgb(247, 240, 240);
background: #8ad3b8;
/* margin: 100px 250px; */
height: 100%;
width: 99%;
display: flex;
justify-content: center;
align-content: center;
}
.main {
text-align: center;
/* align-content: center; */
margin: 4% auto;
width: 57%;
height: 65%;
background: rgba(12, 134, 85, 1);
border-radius: 20px;
border: 10px solid rgba(12, 134, 85, .4);
box-shadow: 0 0 50px rgba(12, 134, 85, 1);
min-height: 450px;
}
h1 {
margin: 0;
padding: 20px 0 0 0;
font-size: 500%;
}
h3,
section,
.start-timer {
margin: 0;
padding: 10px;
display: inline-block;
border-radius: 20px;
}
h6 {
margin: 0;
padding: 0 0 20px 0;
font-size: 10px;
}
header,
section {
margin: 0px;
}
section+section {
padding: 10px;
}
button {
background: #fe483b;
/* border-radius: 10px; */
border: 2px solid #fe483b;
}
.start-timer-section {
/* margin: 140px 0 0 0; */
outline: none;
display: flex;
flex-direction: column;
margin-top: 15%;
position: relative;
}
/* List */
.dropdown-list,
li,
a {
display: inline-block;
margin: 10px 15px 10px 10px;
color: black;
text-decoration: none;
background: #8ad3b8;
border-radius: 5px;
outline: none;
}
.dropdown-list,
li {
border-radius: 40px;
}
a {
/* display: block; height: 100%; width:100%; */
text-decoration: none;
border-radius: 5px;
color: black;
font-size: 12px;
}
.dropdown-list a:hover {
background: #fe483b;
}
/* .legs{
margin: 10px 30px 0 15px;
padding: 0 20px 0 0;
} */
/* ---THE CARD--- */
.cardDeck {
display: flex;
flex-direction: row;
justify-content: space-evenly;
padding: none;
box-shadow: 0 0 20px rgba(250, 241, 241, 0.6);
margin: 0 0 15px 0;
}
.card-directions {
border: 2px solid purple;
display: flex;
flex-direction: column;
min-height: 150px;
min-width: 35%;
}
.card-picture {
border: 2px solid yellow;
visibility: none;
min-width: 35%;
}
.button-timer {
display: flex;
flex-direction: column;
justify-content: center;
align-content: center;
border: 2px solid pink;
/* min-height: 150px; */
min-width: 15%;
flex-wrap: wrap;
}
h3 {
font-size: 15px;
}
/* ---TIMER ANIMATION--- */
body {
padding: 20px;
}
/* div.circle-ani {
transition: 4s ease;
position: relative;
width: 0px;
height: 0px;
text-align: center;
background: hsl(4, 99%, 61%, .7);
color: white;
border-radius: 100%;
padding: 40px;
overflow: hidden;
margin-bottom: -35%;
}
.animate {
transform: scale(1.9);
-webkit-transform: scale(1.9);
-ms-transform: scale(1.9);
} */
.circle-ani {
position: relative;
width: 0px;
height: 0px;
text-align: center;
background: hsl(4, 99%, 61%, .7);
color: white;
border-radius: 100%;
padding: 40px;
overflow: hidden;
display: flex;
align-items: center;
justify-content: center;
}
div.animate {
/* animation properties */
animation-name: my-animation;
animation-duration: 3s;
animation-direction: alternate;
animation-iteration-count: 10;
animation-timing-function: ease-in-out;
/* other properties */
/* position: relative;
width: 0px;
height: 0px;
text-align: center;
background: hsl(4, 99%, 61%, .7);
color: white;
border-radius: 100%;
padding: 40px;
overflow: hidden;
margin-bottom: -35%; */
}
#keyframes my-animation {
from {
background-color: hsl(4, 99%, 61%, .7);
}
to {
padding;
0;
}
}
/* ---Accessibility--- */
#media screen and (max-width: 1111px) {
body {
/* background: red; */
}
main {
width: 100%;
}
h1 {
padding: none;
margin: -7% 0 0 0;
}
h6 {
display: none;
}
.body-image {
padding: -10px;
}
.cardDeck {
display: flex;
flex-direction: row;
justify-content: space-evenly;
flex-wrap: wrap;
padding: none;
margin: 0 0 15px 0;
}
.card-directions {
min-height: auto;
display: flex;
flex-direction: row;
width: 100%;
}
.card-picture {
display: flex;
flex-direction: row;
width: 43%;
visibility: none;
/* min-height: 150px;
min-width: 150px; */
}
.button-timer {
display: flex;
flex-direction: row;
width: 43%;
min-height: 50px;
min-width: 150px;
}
.start-timer {
margin: auto;
outline: none;
}
/* .dropdown-list, li, a{
display: none;
} */
/* // --- DROPDOWN MENU--- // */
.body-image {
display: flex;
max-height: 30%;
max-width: 30%;
margin: 0;
padding: 0;
z-index: 5;
background: rgba(12, 134, 85, 1);
}
a {
cursor: pointer;
}
.dropdown {
display: flex;
justify-content: center;
align-content: center;
flex-wrap: wrap;
}
.dropdown li {
letter-spacing: .5px;
display: flex;
justify-content: center;
}
/* Dropdown Content (Hidden by Default) */
.dropdown-list {
display: none;
position: absolute;
min-width: 150px;
box-shadow: 0px 10px 16px 10px rgba(0, 0, 0, 0.5);
z-index: 1;
margin: 0;
margin-top: -35%;
padding: 0;
}
/* Links inside the dropdown */
.dropdown-list li {
color: black;
padding: 12px 16px;
text-decoration: none;
display: block;
text-align: center;
margin: 0;
}
/* Change color of dropdown links on hover */
.dropdown-list a:hover {
background-color: #fe483b
}
.show {
display: block;
}
}
#media screen and (max-width: 911px) {
body {
/* background: purple; */
}
.card-picture,
.button-timer {
width: 40%;
}
}
#media screen and (max-width: 679px) {
body {
/* background: orange; */
}
.card-picture,
.button-timer {
width: 39%;
}
h1 {
font-size: 300%;
padding: 0;
}
}
#media screen and (max-width: 649px) {
body {
/* background: yellow; */
}
.card-picture,
.button-timer {
width: 36%;
}
body {
margin: 0;
}
}
#media screen and (max-width: 619px) {
body {
/* background: pink; */
}
html {
height: 60%;
margin: 0;
}
.card-picture,
.button-timer {
width: 20%;
height: 200px;
flex-direction: column;
}
.main {
width: 100%;
height: 150%;
min-height: none;
margin-left: 5px;
}
.dropdown-list {
margin: -40% 0 20% 0;
}
}
#media screen and (max-width: 430px) {
.main {
height: 155%;
}
.dropdown-list {
margin-top: -100%;
margin-bottom: 50%;
width: 40%;
}
}
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Fetch a Stretch</title>
<link rel="stylesheet" type="text/css" href="style.css" media="screen" />
<link href="https://fonts.googleapis.com/css2?family=Gentium+Book+Plus&family=Noto+Serif&display=swap" rel="stylesheet">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.6.0/jquery.min.js"></script>
</head>
<body>
<main class="main">
<header>
<!-- <img id = "menu" onclick = "dropdownFunction()" class="body-image" src="body.ico" alt ="body" > -->
<a onclick="myFunction()" title="Body Parts" class="body-image body-ico"><img id="menu" class="body-image" src="body.ico"> </a>
<h1>Fetch a Stretch</h1>
</header>
<section>
<h6>Welcome to moving better!</h6>
<section class="cardDeck">
<section class="card-directions">
<h3>Stretch: Lorem ipsum dolor sit.</h3>
<h3>Explanation: Lorem ipsum, dolor sit amet consectetur adipisicing elit. Tenetur, autem? Iusto itaque quae perspiciatis illo nostrum aspernatur voluptatum, libero sit provident accusantium explicabo est harum omnis quod? Amet, maiores inventore.</h3>
</section>
<section class="card-picture">
<h3>Picture:</h3>
</section>
<section class="button-timer">
<div id="circle" class="circle-ani">
<h2 id="sec">30</h2>
</div>
<div class="start-timer-section">
<button onclick="start()" id='start' class="start-timer">Start Timer</button>
</div>
</section>
</section>
<span id="dropdownClick" class="dropdown">
<ul id = "myDropdown" class="dropdown-list">
<li class="neck">Neck</li>
<li class="shoulders">Shoulders</li>
<li class="hands">Hands</li>
<li class="back">Low Back</li>
<li class="hips">Hips</li>
<li class="legs">Legs</li>
</ul>
</span>
</section>
</main>
<script type="text/javascript" src="main.js"></script>
</body>
</html>
I am trying to implement fade-in scale effect in a Bulma CSS modal component with react and scss. It opens (gets active) when I click on a button which turns a state variable this.state.open to true as shown in the code below.
<div
className={
this.state.open
? (this.props.modalClass || 'login-modal') + ' modal is-mobile is-active'
: ' modal is-mobile'
}
id={this.props.modalId || 'login-modal'}
>
<div className={`modal-background ${this.state.open && 'modal-bg-active' }`}></div>
<div className={`modal-content ${this.state.open && 'modal-content-active'}`}>
<div ref={node => (this.wrapperRef = node)} className='modal-content-inner columns is-multiline'>
<div className='column left-content'></div>
<div className='column right-content'>
<div className='text-container'>
<div className='text-inner-container'>
.
.
.
.
I didn't add the entire markup here as in most websites I have seen the classes used for animating are modal,modal-background, and modal-content
The sass code I have written for the modal is:
.modal.login-modal {
z-index: 1000;
.modal-background {
transition: all 3s;
opacity: 0;
}
.modal-content {
background: #fff;
max-width: 840px;
width: 100%;
transform: scale(0.7);
opacity: 0;
transition: all 3s;
}
&.is-active {
visibility: visible;
.modal-background {
opacity: 1;
#include box_shadow_dark();
background-color: rgba(0, 0, 0, 0.85);
}
.modal-content {
transform: scale(1);
opacity: 1;
}
}
// .modal-background.modal-bg-active {
// visibility: visible;
// opacity: 1;
// #include box_shadow_dark();
// background-color: rgba(0, 0, 0, 0.85);
// }
// .modal-content {
// background: #fff;
// max-width: 840px;
// width: 100%;
// transform: scale(0.7);
// opacity: 0;
// transition: all 0.3s;
// }
// .modal-content.modal-content-active {
// transform: scale(1);
// opacity: 1;
// }
//==================================================> EXTRA CODE FOR CONTENT INSIDE MODAL
.left-content {
background-color: #fff;
background-image: url('https:some_url');
#include tablet_only {
display: none;
background-image: none;
}
#include mobile_only {
display: none;
background-image: none;
}
}
.right-content {
background: #fff;
.text-container {
text-align: center;
box-sizing: border-box;
#include mobile_only {
padding: 0;
}
}
.text-inner-container {
padding: 40px;
#include mobile_only {
padding: 30px;
height: auto;
}
}
}
// ==================================== Prompt
.prompt-text {
margin: 15px auto 25px;
font-size: 18px;
text-align: left;
}
// ===================================== Email OTP Fields
.user-input-field {
input {
font-size: 14px;
padding: 12px 15px;
width: 100%;
height: auto;
border-width: 2px;
}
label {
font-size: 13px;
text-align: left;
margin-bottom: 10px;
font-weight: $fontWeightBold;
}
.error-message {
font-size: 13px;
color: red;
text-align: left;
margin: 8px 0px 5px;
font-weight: $fontWeightBold;
}
}
.otp-button {
margin: 15px auto 20px;
padding: 11px 15px;
}
// ====================================== Login Buttons
.login-button {
border-radius: 4px;
padding: 13px 15px;
width: 100%;
font-size: 15px;
cursor: pointer;
height: auto;
font-weight: $fontWeightExtraBold;
#include box_shadow_dark();
}
.facebook-login-js {
display: inline-block;
color: white;
margin: 20px auto 15px;
background-color: $fbBlue;
border: none;
&:hover {
background-color: $fbBlueDark;
}
}
// google login
.google-login-js {
display: inline-block;
color: white;
margin: 0px auto 15px;
background-color: $gplusRed;
border: none;
&:hover {
background-color: $gplusRedDark;
}
}
// ========================================== Seperator
.seperator-text-container {
.seperator-text {
font-weight: $fontWeightBold;
color: #555555;
}
}
.terms-line {
font-size: 10px;
}
//=========================================================> EXTRA CODE FOR CONTENT INSIDE MODAL
}
}
What am I getting wrong here? How should I change the code for it to work? I will surely provide more details if required to understand it. Thank you!
I believe the issue is that bulma modal class has display: none property which can not be animated. Try overwriting it to display: block.
Or you could possibly use something like this https://github.com/postare/bulma-modal-fx
I want to edit the default audio tag. Or at-least
.sqs-audio-player-content{
background-color: #b3b3b3 !important;
background-image: linear-gradient(#eaeaea, #eaeaea) !important;
background: -webkit-linear-gradient(#b3b3b3, #eaeaea) !important;
border: 0px solid #b3b3b3 !important;
border-radius: 0px 0px 0px 0px;
color: #6B6B6B;
}
.audio-author {
color: red !important;
}
.audio-title {
color: #ffffff !important;
}
.volume .bar.active {
border-right-color: #36b3a8 !important;
}
.volume .bar {
border-right-color: pink !important;
}
.progress {
background: none repeat scroll 0 0 #707070 !important;
}
.controls {
color: #707070 !important;
}
remove the pause and mute mute. Have tried adding this to css, but doesn't work
A customized audio player with controls . If you are looking for something like this, this might help you solve your problem.
function $(id) { return document.getElementById(id); };
const media = document.getElementById('audio');
let ui = {
play: 'playAudio',
audio: 'audio',
percentage: 'percentage',
seekObj: 'seekObj',
currentTime: 'currentTime'
};
function togglePlay() {
if (media.paused === false) {
media.pause();
$(ui.play).classList.remove('pause');
} else {
media.play();
$(ui.play).classList.add('pause');
}
}
function calculatePercentPlayed() {
let percentage = (media.currentTime / media.duration).toFixed(2) * 100;
$(ui.percentage).style.width = `${percentage}%`;
}
function calculateCurrentValue(currentTime) {
const currentMinute = parseInt(currentTime / 60) % 60;
const currentSecondsLong = currentTime % 60;
const currentSeconds = currentSecondsLong.toFixed();
const currentTimeFormatted = `${currentMinute < 10 ? `0${currentMinute}` : currentMinute}:${
currentSeconds < 10 ? `0${currentSeconds}` : currentSeconds
}`;
return currentTimeFormatted;
}
function initProgressBar() {
const currentTime = calculateCurrentValue(media.currentTime);
$(ui.currentTime).innerHTML = currentTime;
$(ui.seekObj).addEventListener('click', seek);
media.onended = () => {
$(ui.play).classList.remove('pause');
$(ui.percentage).style.width = 0;
$(ui.currentTime).innerHTML = '00:00';
};
function seek(e) {
const percent = e.offsetX / this.offsetWidth;
media.currentTime = percent * media.duration;
}
calculatePercentPlayed();
}
$(ui.play).addEventListener('click', togglePlay)
$(ui.audio).addEventListener('timeupdate', initProgressBar);
* {
box-sizing: border-box;
}
body {
background-size: 6px 6px !important;
background-image: linear-gradient(-45deg, rgba(0, 0, 0, 0) 46%, coral 49%, coral 51%, rgba(0, 0, 0, 0) 55%);
background-color: white;
padding-top: 60px;
}
.audio-player {
width: 470px;
padding: 35px 20px;
margin: auto;
background-color: white;
border: 1px solid black;
}
.audio-player .player-controls {
position: relative;
display: flex;
justify-content: space-between;
align-items: center;
}
.audio-player #radioIcon {
width: 30px;
height: 30px;
background: url("https://image.flaticon.com/icons/svg/149/149429.svg") no-repeat center;
}
.audio-player #playAudio {
-webkit-appearance: none;
outline: none;
cursor: pointer;
border: none;
width: 30px;
height: 30px;
background: url("https://image.flaticon.com/icons/svg/149/149125.svg") no-repeat center;
background-size: contain;
}
.audio-player #playAudio.pause {
background-size: contain;
}
.audio-player p {
margin: 0 0 0 5px;
line-height: 1;
display: inline-flex;
}
.audio-player p small {
font-size: 10px;
}
.audio-player #seekObjContainer {
position: relative;
width: 300px;
margin: 0 5px;
height: 5px;
}
.audio-player #seekObjContainer #seekObj {
position: relative;
width: 100%;
height: 100%;
background-color: #e3e3e3;
border: 1px solid black;
}
.audio-player #seekObjContainer #seekObj #percentage {
position: absolute;
left: 0;
top: 0;
height: 100%;
background-color: coral;
}
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width">
<title>JS Bin</title>
</head>
<body>
<div class="audio-player">
<audio id="audio">
<source src="https://thenewcode.com/assets/audio/24-ghosts-III.mp3" type="audio/mp3">
</audio>
<div class="player-controls">
<div id="radioIcon"></div>
<button id="playAudio"></button>
<div id="seekObjContainer">
<div id="seekObj">
<div id="percentage"></div>
</div>
</div>
<p><small id="currentTime">00:00</small></p>
</div>
</div>
</body>
</html>
The source code taken from : Thanks /AliKlein
I've found on Google a doc example for Bootstrap 4.1 in which they feature floating labels: getbootstrap.com/docs/4.1/examples/floating-labels/
In that page, however, it is not explained how that can be achieved, and I can't find anything in the docs for v. 4.1. Floating labels are not even listed as a new feature in the ship list.
Does anyone know if floating labels are supported?
It says on the Bootstrap examples page that floating-labels are...
"Experiments - Examples that focus on future-friendly features or
techniques."
Like many of the other examples, there's an additional CSS file used in the example...
Using the floating-labels.css they work as expected in the supported browsers...
https://www.codeply.com/go/X9VbHqzD4B
Best way for me is using transform translate. It is smoother. I have added extra classes to prevent overwriting bootstraps original classes.
body{padding:75px}
.form-group.floating>label {
bottom: 34px;
left: 8px;
position: relative;
background-color: white;
padding: 0px 5px 0px 5px;
font-size: 1.1em;
transition: 0.1s;
pointer-events: none;
font-weight: 500 !important;
transform-origin: bottom left;
}
.form-control.floating:focus~label{
transform: translate(1px,-85%) scale(0.80);
opacity: .8;
color: #005ebf;
}
.form-control.floating:valid~label{
transform-origin: bottom left;
transform: translate(1px,-85%) scale(0.80);
opacity: .8;
}
<link href="https://stackpath.bootstrapcdn.com/bootstrap/4.5.2/css/bootstrap.min.css" rel="stylesheet"/>
<div class="form-group floating">
<input type="text" class="form-control floating" id="usr" required value="">
<label for="usr">Username</label>
</div>
Styles they ware using in that mentioned example site
:root {
--input-padding-x: .75rem;
--input-padding-y: .75rem;
}
html,
body {
height: 100%;
}
body {
display: -ms-flexbox;
display: -webkit-box;
display: flex;
-ms-flex-align: center;
-ms-flex-pack: center;
-webkit-box-align: center;
align-items: center;
-webkit-box-pack: center;
justify-content: center;
padding-top: 40px;
padding-bottom: 40px;
background-color: #f5f5f5;
}
.form-signin {
width: 100%;
max-width: 420px;
padding: 15px;
margin: 0 auto;
}
.form-label-group {
position: relative;
margin-bottom: 1rem;
}
.form-label-group > input,
.form-label-group > label {
padding: var(--input-padding-y) var(--input-padding-x);
}
.form-label-group > label {
position: absolute;
top: 0;
left: 0;
display: block;
width: 100%;
margin-bottom: 0; /* Override default `<label>` margin */
line-height: 1.5;
color: #495057;
border: 1px solid transparent;
border-radius: .25rem;
transition: all .1s ease-in-out;
}
.form-label-group input::-webkit-input-placeholder {
color: transparent;
}
.form-label-group input:-ms-input-placeholder {
color: transparent;
}
.form-label-group input::-ms-input-placeholder {
color: transparent;
}
.form-label-group input::-moz-placeholder {
color: transparent;
}
.form-label-group input::placeholder {
color: transparent;
}
.form-label-group input:not(:placeholder-shown) {
padding-top: calc(var(--input-padding-y) + var(--input-padding-y) * (2 / 3));
padding-bottom: calc(var(--input-padding-y) / 3);
}
.form-label-group input:not(:placeholder-shown) ~ label {
padding-top: calc(var(--input-padding-y) / 3);
padding-bottom: calc(var(--input-padding-y) / 3);
font-size: 12px;
color: #777;
}
If you really want floating label, see this awesome Bootstrap 4 theme : http://djibe.github.io/material/docs/4.4/material/text-fields/
SCSS version below including support for textarea and excluding styles from IE11, which doesn't support :placeholder-shown.
:root {
--input-padding-x: .75rem;
--input-padding-y: .75rem;
}
.floating-label {
$placeholderColour: $middleGrey;
position: relative;
input, textarea, label {
padding: var(--input-padding-y) var(--input-padding-x);
}
label {
position: absolute;
top: 0;
left: 0;
display: block;
margin-bottom: 0;
line-height: 1.5;
color: $placeholderColour;
border: 1px solid transparent;
border-radius: .25rem;
transition: all .1s ease-in-out;
&:hover {
cursor: text;
}
}
input::-webkit-input-placeholder {
color: transparent;
}
input:-ms-input-placeholder {
color: transparent;
}
input::-ms-input-placeholder {
color: transparent;
}
input::-moz-placeholder {
color: transparent;
}
input::placeholder {
color: transparent;
}
textarea::-webkit-input-placeholder {
color: transparent;
}
textarea:-moz-placeholder {
color: transparent;
}
textarea::-moz-placeholder {
color: transparent;
}
textarea:-ms-input-placeholder {
color: transparent;
}
textarea::placeholder {
color: transparent;
}
input:not(:placeholder-shown),
textarea:not(:placeholder-shown) {
padding-top: calc(var(--input-padding-y) + var(--input-padding-y) * (2 / 3));
padding-bottom: calc(var(--input-padding-y) / 3);
}
input:not(:placeholder-shown) ~ label,
textarea:not(:placeholder-shown) ~ label {
padding-top: calc(var(--input-padding-y) / 3);
padding-bottom: calc(var(--input-padding-y) / 3);
font-size: 12px;
&:hover {
cursor: default;
}
}
#media screen and (-ms-high-contrast: active), (-ms-high-contrast: none) {
label {
display: none;
}
textarea:-ms-input-placeholder, input:-ms-input-placeholder {
color: $placeholderColour;
}
textarea::-ms-input-placeholder, input::-ms-input-placeholder {
color: $placeholderColour;
}
}
}
I've created an input floating label for Bootstrap 4 & 5 (not the same look that Bootstrap provides): https://github.com/tkrotoff/bootstrap-floating-label
Here is the online demo: https://codesandbox.io/s/github/tkrotoff/bootstrap-floating-label/tree/codesandbox.io
I have an Ionic 2 app, that has an ion-searchbar.
<div id="search" class="search-input-keyword">
<ion-searchbar class="ion-searchtext" id="ion-searchtext" [(ngModel)]="searchQueryText" (ionFocus)="focusSearch($event)"
(change)="onChangeText($event)" (ionClear)="onCancelText($event)" (ionInput)="onInputText($event)" placeholder="{{jobType === 0 ? favourite ? 'Market Favourites' : 'Market' : favourite ? 'Postings Favourites' : 'Postings'}}"
debounce="1"></ion-searchbar>
</div>
I would like to change the input text color, and the magnifying glass icon color to #fff.
I have read here, that in order to do so, you need to change the sass variables.
I have tried the following in variables.scss:
$colors: (
primary: #009196,
secondary: #32db64,
danger: #f53d3d,
light: #f4f4f4,
dark: #222
);
$searchbar-ios-input-text-color: #fff;
$searchbar-ios-input-search-icon-color: #fff;
But there is no effect.
However, the following line does have an effect:
$text-color: #000099;
So I guess that the $searchbar-ios-input-text-color: #fff; and $searchbar-ios-input-search-icon-color: #fff; are the issue.
Question
Can anyone please advise how to change the font and icon colours?
Thanks
UPDATE
Here is some more code samples:
css
.toolbar-background-md {
background: linear-gradient(to bottom right, #00a7ad, #004547);
}
.bar-button-default-md {
color: #fff;
}
.searchbar-md .searchbar-input {
background: linear-gradient(to bottom right, #009da3, #018287);
//background-color: #009196;
}
input::-webkit-input-placeholder {
color: red ;
}
input:-moz-placeholder {
color: red ;
}
input:-ms-input-placeholder { /* IE10+ */
color: red ;
}
.toolbar-title-md {
padding: 0 12px;
font-size: 2rem;
font-weight: 500;
color: #fff;
}
.close-filters {
color: #fff;
width: 52px;
font-size: 22px;
background-color: transparent;
box-shadow: none !important;
}
.slide-fade-hide {
transition: 1s all linear;
opacity: 0;
height: 0;
position: absolute;
top: 0;
z-index: -10;
}
.slide-fade-show {
transition: all 1.2s ease-in;
opacity: 1;
height: 2em;
z-index: 1;
}
.list-md {
margin: 0px 0px 0px 0;
}
.scroll-up {
margin-top: 20px;
}
.menu-title {
padding: 1px 95px 1px 10px;
}
.menu-toolbar {
padding: 35px;
}
.menu-content {
position: relative !important;
}
.item-search-wanted {
padding-left: 1px;
}
.item-search-offered {
padding-left: 1px;
}
.job-content-offered {
background-color: white !important;
}
.job-content-wanted {
background-color: white !important;
}
.search-button-star {
background-color: #009196;
}
.search-input-keyword {
width: 125%;
display: flex;
}
.search-input {
width: 125%;
}
.toolbar-content {
display: flex;
}
.extra-search-col {
padding: 0px;
}
ion-col {
padding: 2px;
}
ion-title {
z-index: 11;
}
ion-avatar img {
border-radius: 2.8rem;
max-height: 5.6rem;
max-width: 5.6rem;
}
.small-text-search {
font-size: 75% !important;
color: grey !important;
padding-top: 4px;
}
.small-text-search-desc {
font-size: 85%;
}
.small-text-search-rating {
padding-top: inherit;
padding-left: inherit;
}
.small-text-search-starrating {
padding-top: 2px;
font-size: 100% ! important;
}
.search-category {
float: right;
}
.job-tite {
width: 250px;
}
.job-timestamp {
white-space: nowrap;
}
.search-rating {
float: left;
}
.search-popover-button {
width: 75px;
height: 75px;
}
.button-icon-only ion-icon.search-popover-icon {
font-size: 2.8em;
}
.filter-image {
-webkit-filter : hue-rotate(-30deg) opacity(100%);
filter : hue-rotate(-30deg) opacity(100%);
}
.icon-text {
padding-left: 5px;
padding-bottom: 3px;
}
.icon-text-no {
padding-left: 5px;
}