interactionld Posted May 25, 2021 Share Posted May 25, 2021 Site URL: https://www.interaction-ld.com/coaching Hi - I have added some code to create a flip effect that I was sent. It seems that the hover action does not quite work on touchscreen even though it has the code that should make it work ok. If you click on the cards (on any device) it takes you to the top of the screen - can I add .on-click to behave the same as hover in this code? I tried adding it in and the cards just disappeared. It also does not render very well on Tablets - I'd like to enforce a 2-column layout as at the moment it overlaps the cards and I cannot quite get it to do that. Example HTML below. <a href="#"> <div class="flip-container" ontouchstart="this.classList.toggle('hover');"> <div class="flipper"> <div class="front"><h3>Executive</br>development</h3><p>Structured coaching for senior leaders using highly qualified, executive coaches</p> </div> <div class="back"> <p><strong>You can expect:</strong></p> <ul> <li>that the correct coach is matched for optimum chemistry and rapport</li> <li>far-reaching, transformational behavioural change</li> <li>coaching conversations focused on tangible actions</li> </ul></div> </div> </div> </a> .flip-container {perspective: 1000px; transform-style: preserve-3d;} .flip-container:hover .back {transform: rotateY(0deg);} .flip-container:hover .front {transform: rotateY(180deg);} .flip-container, .front, .back { width: 324px; height: 245px; margin: 0px; float: left; } .flipper {transition: 0.6s; transform-style: preserve-3d; position: relative;} /* hide back of pane during swap */ .front, .back { backface-visibility: hidden; transition: 0.6s; transform-style: preserve-3d; position: absolute; top: 0; left: 0; } .front {z-index: 2; transform: rotateY(0deg);} .back { transform: rotateY(-180deg); background: #F0F0F0; color: #00000 ; text-align:left; p{padding-left:10px;padding-top:6px;} ul{padding-left:30px;} line-height:1.23em; } .vertical.flip-container {position: relative;} .vertical .back { transform: rotateX(180deg);} .vertical.flip-container:hover .back {transform: rotateX(0deg);} .vertical.flip-container:hover .front {transform: rotateX(180deg);} .front {background:#F0F0F0; color:#000000; text-align:left; h3{ color: #CE0058 !important; padding-left:10px; padding-top:6px;} p{ padding-left: 10px; }} <a href="#"> <div class="flip-container" ontouchstart="this.classList.toggle('hover');"> <div class="flipper"> <div class="front"><h3>Executive</br>development</h3><p>Structured coaching for senior leaders using highly qualified, executive coaches</p> </div> <div class="back"> <p><strong>You can expect:</strong></p> <ul> <li>that the correct coach is matched for optimum chemistry and rapport</li> <li>far-reaching, transformational behavioural change</li> <li>coaching conversations focused on tangible actions</li> </ul></div> </div> </div> </a> Link to comment
tuanphan Posted May 26, 2021 Share Posted May 26, 2021 Q1. You mean you want when clicking on each box >> It will redirect to new page? Q2. Change to 2 boxes/row? Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
interactionld Posted May 27, 2021 Author Share Posted May 27, 2021 Hello @tuanphan. Q1: I don't want it to redirect to anywhere on click, just to flip to show the back card in the same way as the Hover does. On mobile and Desktop at the moment, it seems to jump to the top of the page when you click it and I don't want it to do that. Q2: Yes, 2 boxes per row - just so that the cards don't overlap each other and you can read them clearly. Thank you Laura Link to comment
tuanphan Posted May 28, 2021 Share Posted May 28, 2021 Q1. In this code Quote <a href="#"> remove href="#". It should be Quote <a> Q2. Add to Design > Custom CSS /* Tablet-Coaching flip cards */ @media screen and (max-width:991px) and (min-width:768px) { div#page-604791783e6fec3843566230 .span-4 { width: 100%; } div#page-604791783e6fec3843566230 .span-4 { width: 100%; display: flex; } div#page-604791783e6fec3843566230 .span-4 .code-block { width: 50%; } div#page-604791783e6fec3843566230 .span-4 .horizontalrule-block { display: none; } } Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
interactionld Posted May 28, 2021 Author Share Posted May 28, 2021 Thanks so much - that's sorted Q1 😀 Q2: it's still overlapping the 3 cards in tablet view. I do have some code for tablet view for the homepage, but it is on specific blocks - could this be competing with the new code somehow? /* tablet issues */ @media screen and (max-width:991px) and (min-width:768px) { div#block-yui_3_17_2_1_1412381143917_19852 + .row .button-block a { min-height: 50px; vertical-align: middle; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-align: center; -ms-flex-align: center; align-items: center; -ms-flex-wrap: nowrap; flex-wrap: nowrap; } div#block-yui_3_17_2_1_1412381143917_19852+.row .button-block { padding: 2px; } } Link to comment
tuanphan Posted May 28, 2021 Share Posted May 28, 2021 3 hours ago, interactionld said: Thanks so much - that's sorted Q1 😀 Q2: it's still overlapping the 3 cards in tablet view. I do have some code for tablet view for the homepage, but it is on specific blocks - could this be competing with the new code somehow? /* tablet issues */ @media screen and (max-width:991px) and (min-width:768px) { div#block-yui_3_17_2_1_1412381143917_19852 + .row .button-block a { min-height: 50px; vertical-align: middle; display: -webkit-box; display: -ms-flexbox; display: flex; -webkit-box-align: center; -ms-flex-align: center; align-items: center; -ms-flex-wrap: nowrap; flex-wrap: nowrap; } div#block-yui_3_17_2_1_1412381143917_19852+.row .button-block { padding: 2px; } } Do you use iPad Pro? Change 991px to 1024px Email me if you have need any help (free, of course.). Answer within 24 hours. Or send to forum message Contact Customer Care - Learn CSS - Buy me a coffee (thank you!) Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment