Hi everyone.
I’ve been working on my hover-state for this specific page with a portfolio-post query loop. I’m very happy with how it looks on desktop/mouse devices but can’t seem to entirely get it to work on mobile.
Here’s the page I’m talking about: Beelden Archives | Jolanda Meulendijks
It’s all set up in the element that houses the query, with only a transition and the following CSS through bricks. Within the query are the image (clickable to post), title (clickable to post) and subtitle. That’s basically how it’s set up.
/* hover devices */
@media (hover: hover) {
%root%:hover img {
opacity:0.5; }
%root%:hover a {
text-decoration: none;
color: #ff6600; }
h1::after {
content: '';
position: absolute;
width: 100%;
transform: scaleX(0);
height: 2px;
bottom: 5px;
left: 0;
background-color: #ff6600;
color: #ff6600;
transform-origin: bottom right;
transition: transform 0.25s ease-out; }
%root%:hover h1::after {
transform: scaleX(1);
transform-origin: bottom left;
color: #ff6600; }
}
/* non-hover devices */
@media (hover: none) {
%root%:active img {
opacity:0.5; }
%root%:active a {
text-decoration: none;
color: #ff6600; }
h1::after {
content: '';
position: absolute;
width: 100%;
transform: scaleX(0);
height: 2px;
bottom: 5px;
left: 0;
background-color: #ff6600;
color: #ff6600;
transform-origin: bottom right;
transition: transform 0.25s ease-out; }
%root%:active h1::after {
transform: scaleX(1);
transform-origin: bottom left;
color: #ff6600; }
}
The top part of the code seems to work flawlessly, and I understood that for touch devices you could replace :hover with :active but it’s not working 100%. I want this state to be triggered when you scroll past the post, so whenever your finger is “touching” the entire div would be a great start.
Currently it looks like it’s doing this; but ONLY for the first post of the page and that’s where I’m at a loss for what to try cause this obviously is supposed to work for all posts on the page. Other than that the way it works on the first page seems good; it triggers the hoverstate when you scroll by, and undo’s the changes when you get past it, just not for anything past this point.
Anyone have an idea? More info needed to fix this? Let me know!
UPDATE: I just checked in safari (iOS, I’m usually using Chrome) and in safari it’s doing nothing at all. So this “hover state only works once” only counts for iOS chrome I guess. No clue what is happening.