Currently, I am working on my random quote generator project and I am trying to make it so that when the button is touched on a mobile device, the background color becomes semi-transparent. Below is the code I am using:
#loadQuote {
position: fixed;
width: 12em;
display: inline-block;
left: 50%;
margin-left: -6em;
bottom: 50px;
border-radius: 4px;
border: 2px solid #fff;
color: #fff;
background-color: black;
padding: 10px 0;
transition: .5s ;
}
#loadQuote:active {
background-color: rgba(255,255,255,.25);
-webkit-transition: background-color 10ms linear;
-ms-transition: background-color 10ms linear;
transition: background-color 10ms linear;
}
I tested this on the Google Chrome emulator and it worked correctly. However, when I tried it on my iPhone, the effect did not work as expected. I am unsure why this is happening. Additionally, it was strange that when I initially set the transition duration to 1000ms, the background changed very quickly. But when I reduced it to 10ms, the change was slower and more noticeable. This puzzled me, as I would expect longer durations to result in longer animations.
If you want to see the live demo of the project, you can visit .
Thank you!