I've built a navmenu that has shown/hidden after click a button. In transition I change opasity .box navmenu and height .menu-box links.
But it works only when navmenu is shown. When I try to hide transition doesn't work, navmenu is hidden right away, without animation and time animation.
html
<div class="box " [ngClass]="{'show-mobile-navmenu' : showMobileNavmenu }">
<div class="menu-box" [ngClass]="{'show-menu-box' : showMobileNavmenu }">
<div class="menu " >
<div class="link" *ngFor="let link of links">
<modal-link [link]="link"></modal-link>
</div>
<div class="link">
<span class="a-link" (click)="changeLanguage()">{{'lang' | translate }}</span>
</div>
</div>
</div>
</div>
css
.link {
text-align: center;
}
.a-link {
font-size: 24px;
line-height: 48px;
width: 100%;
font-weight: bold;
}
.box {
background-color: #fff;
opacity: 0;
height: 0;
position: fixed;
left: 0;
width: 100%;
top: 69px;
z-index: 100;
overflow-y: auto;
scrollbar-width: none; /* Firefox */
-ms-overflow-style: none; /* IE 10+ */
transition: opacity 0.5s ease-in-out;
}
.box::-webkit-scrollbar {
/* WebKit */
width: 0;
height: 0;
}
.box.show-mobile-navmenu {
height: calc(100vh - 69px);
opacity: 0.8;
}
.menu-box {
position: relative;
margin-top: -8px;
padding: 20px;
display: flex;
justify-content: center;
align-items: center;
min-height: 400px;
opacity: 0;
transition: min-height .5s ease-out, opacity .5s ease-in;
}
.show-menu-box {
min-height: 100%;
opacity: 1;
}
.menu {
width: 100%;
padding-top: 38px;
padding-left: 3px;
}
How to do that when I hide navmenu opacity goes from 1 to 0 and links go down?
Related
I am trying to make a animated ribbon but I have had luck making it.
When I use hover on left-id it works but when I try to use on RibbonContainer or right-id it doesn't work.
#RibbonText {
background: #5bdfb8;
color: #009;
font-size: 12px;
height: 100%;
width: 0;
visibility: visible;
transition: width .5s, padding-right .5s, visibility .5s;
white-space: nowrap;
overflow: hidden;
text-overflow: ellipsis;
line-height: 30px;
}
#RibbonContainer {
display: flex;
align-items: stretch;
height: 30px;
position: absolute;
z-index: 1;
top: 10px;
left: -6px;
transition: width 2s, box-shadow 2s;
}
#left {
height: 33px;
}
#RibbonContainer:hover+#RibbonText {
width: 100%;
visibility: visible;
padding-right: 10px;
}
<div class="RibbonContainer">
<img id="left" class="RibbonImage" alt="ribbon-shwadow" src="https://via.placeholder.com/50" />
<span id="RibbonText" class="ribbon">
{ribbonText}
</span>
<img id="right" class="RibbonImage" alt="ribbon-end" src="https://via.placeholder.com/50" />
</div>
The solution is changing this #RibbonContainer:hover + #RibbonText to #RibbonContainer:hover > #RibbonText
I'm trying a pretty basic transition but it's not right on Safari..
All I want to do is change background images from A to B on hover. However, the transition is not working the first time I hover over the element.
On first hover, it is just instantly changing as opposed to gradually fading in/out.
JSFiddle here -- https://jsfiddle.net/RalphCSD/z9nx30co/4/
I'm using a Wordpress site if that makes any difference..
I've also included the HTML & CSS below. If anyone can see any errors that may be causing the issue I would greatly appreciate any help.
.colBox {
width: 100%;
max-width: 300px;
min-height: 400px;
background-image: url("http://www.scatterboxshop.ie/wp-content/uploads/2019/11/Scatterbox-Shop-CTA-Cushions.jpg");
right: 0px;
transition: all .5s ease-in-out;
-webkit-transition: all .5s ease-in-out;
-webkit-backface-visibility: hidden;
}
.colCon {
padding-top: 50px;
padding-left: 35px;
max-width: 200px;
color: white !important;
font-family: 'Montserrat', sans-serif;
}
.colHead {
color: white !important;
font-weight: 400 !important;
font-size: 12px !important;
}
.colHeadLg {
font-size: 40px;
font-weight: 700;
padding-top: 50px;
}
.colP {
font-size: 12px;
line-height: 16px;
}
.moreArrow {
font-size: 20px;
}
.colBox:hover {
width: 100%;
max-width: 300px;
min-height: 400px;
background-image: url("http://www.scatterboxshop.ie/wp-content/uploads/2019/11/Scatterbox-Shop-CTA-Cushions-BG.jpg");
-webkit-backface-visibility: hidden;
}
.hover-div {
width: 200px;
margin-top: 70px;
}
.hover-div .stuff {
margin-top: 0;
position: relative;
width: 100%;
z-index: 2;
-webkit-transition: margin-top 0.5s;
transition: margin-top 0.5s;
}
.hover-div .stuff-hidden {
height: 0;
width: 100%;
overflow: hidden;
-webkit-transition: height 0.5s;
transition: height 0.5s;
}
.hover-div:hover .stuff {
margin-top: -40px;
}
.hover-div:hover .stuff-hidden {
height: 40px;
}
<div class="colBox">
<a href="#">
<div class="colCon">
<h2 class="colHead">CUSHION COLLECTION</h2>
<div class="hover-div">
<div class="stuff">
<p class="colHeadLg">Cushions</p>
<p class="colP">Our luxury feather filled cushions are statement pieces each with a story to tell</p>
</div>
<div class="stuff-hidden">
<p class="moreArrow">More <span><i class="fas fa-arrow-right"></i></span></p>
</div>
</div>
</div>
</a>
</div>
Try increasing the transition time from 0.5 seconds to 1.5 seconds:
.colBox {
width: 100%;
max-width: 300px;
min-height: 400px;
background-image: url("http://www.scatterboxshop.ie/wp-content/uploads/2019/11/Scatterbox-Shop-CTA-Cushions.jpg");
right: 0px;
transition: all 1.5s ease-in-out;
-webkit-transition: all 1.5s ease-in-out;
-webkit-backface-visibility: hidden;
}
You have that jumping in every browser, just rest of them cache the hover image.
Basically, you gotta pre-load the image, which is on hover. Like, set it as background for parent element.
I want to change (a) tag to (li). When i do it css animation stop working. Why? It is not first time when i change (a) tag to (li) but i never have problem like this. Of course you need to do manipulations in css but this time i can not solve this problem. How can i change it?
<div class="panel" id="slice">
<div class="panel__content">
Close me.
</div>
</div>
<div class="menu">
<a class="menu__link" href="#slice" data-hover="Slice">Slice</a>
</div>
.menu {
position: fixed;
width: 100vw;
pointer-events: none;
margin-top: 10vh;
text-align: center;
z-index: 2; }
.menu__link {
display: inline-block;
text-decoration: none;
border: 2px solid #263238;
color: #263238;
pointer-events: auto;
line-height: 40px;
position: relative;
padding: 0 50px;
box-sizing: border-box;
margin: 0;
user-select: none;
overflow: hidden;
border-radius: 50px;
.panel {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
overflow: auto;
z-index: 999;
color: #000;
box-sizing: border-box;
background-color: #ECEFF1; }
.panel__content {
opacity: 0;
will-change: margin-top;
transition: all 700ms;
transition-delay: 600ms;
padding: 100px 200px;
margin-top: -5%; }
.panel:target .panel__content {
opacity: 1;
margin-top: 0; }
.panel#slice {
background-color: #E53935;
transition: all 800ms cubic-bezier(0.190, 1.000, 0.560, 1.000);
transform: translate3d( 0, -100%, 0 ); }
.panel#slice:target {
transform: translate3d( 0, 0, 0 ); }
You'd have to restyle the unordered list for spacing, but maybe instead of outright replacing your menu's <a> elements with <li>, you could include the <a> elements in the resulting list items.
This would preserve all the :target functionality and give you the list (for semantics?).
EDIT: Of course, this won't do at all if your menu just can not consist of anything but <li>.
/* basic style definition */
/* •••••••••••••••••••••••••••••••• */
body {
-webkit-font-smoothing: antialiased;
-moz-osx-font-smoothing: grayscale;
font-family: 'Roboto Slab', serif;
}
h1 {
margin: 0;
user-select: none;
text-align: center;
font-weight: 300;
}
p,
{
font-weight: 300;
color: #546E7A;
user-select: none;
text-align: center;
margin: 0;
}
a {
text-align: center;
text-decoration: none;
color: #FFF;
}
/* Navigation menu */
/* •••••••••••••••••••••••••••••••• */
.menu {
position: fixed;
width: 100vw;
pointer-events: none;
margin-top: 10vh;
text-align: center;
z-index: 2;
}
/* Menu link item */
.menu__link {
display: inline-block;
text-decoration: none;
border: 2px solid #263238;
color: #263238;
pointer-events: auto;
line-height: 40px;
position: relative;
padding: 0 50px;
box-sizing: border-box;
margin: 0;
user-select: none;
overflow: hidden;
border-radius: 50px;
&::before {
content: attr(data-hover);
background-color: #263238;
color: #FFF;
position: absolute;
top: 100%;
bottom: 0;
left: 0;
transition: all 300ms cubic-bezier(0.190, 1.000, 0.560, 1.000);
right: 0;
}
&:hover::before {
top: 0;
}
}
/* Panels Style*/
/* •••••••••••••••••••••••••••••••• */
/* Common panel style */
.panel {
display: flex;
align-items: center;
justify-content: center;
flex-direction: column;
position: absolute;
top: 0;
bottom: 0;
left: 0;
right: 0;
overflow: auto;
z-index: 999;
color: #000;
box-sizing: border-box;
background-color: #ECEFF1;
}
/* panel content (only for animation delay after open) */
.panel__content {
opacity: 0;
will-change: margin-top;
transition: all 700ms;
transition-delay: 600ms;
padding: 100px 200px;
margin-top: -5%;
}
/* Panel content animation after open */
.panel:target .panel__content {
opacity: 1;
margin-top: 0;
}
/* Specific "Home "panel */
/* •••••••••••••••••••••••••••••••• */
.panel#home {
z-index: 1;
background: radial-gradient(ellipse at center, rgba(255, 255, 255, 1) 0%, #CFD8DC 100%);
}
/* Specific panel "Slice" */
/* •••••••••••••••••••••••••••••••• */
.panel#slice {
background-color: #E53935;
transition: all 800ms cubic-bezier(0.190, 1.000, 0.560, 1.000);
transform: translate3d( 0, -100%, 0);
}
.panel#slice:target {
transform: translate3d( 0, 0, 0);
}
/* Specific panel "Fade" effect */
/* •••••••••••••••••••••••••••••••• */
.panel#fade {
background-color: #00C853;
opacity: 0;
transition: all 800ms;
pointer-events: none;
}
.panel#fade:target {
opacity: 1;
pointer-events: auto;
}
<!-- Home Panel -->
<div class="panel" id="home">
<h1>Pure CSS panels</h1>
<p>by Mattia Astorino</p>
</div>
<div class="panel" id="slice">
<div class="panel__content">
<a href="#home">
Close me.
</a>
</div>
</div>
<div class="panel" id="fade">
<div class="panel__content">
Close me.
</div>
</div>
<!-- Navigation -->
<div class="menu">
<ul>
<li>
<a class="menu__link" href="#slice" data-hover="Slice">Slice</a>
</li>
<li>
<a class="menu__link" href="#fade" data-hover="Fade">Fade</a>
</li>
</ul>
</div>
I have a popup in which I made a toggle with the help of pure CSS. Now if I run The popup and move my mouse at the uppermost or the lowermost part of the window the popup start disappear. I am using 0% JAVASCRIPT inside my popup code and can't find what was a reason in the code.
here is the issue:https://imgur.com/a/wHjHB7A
focus on the mouse cursor! Also, I am looking a way to open a popup at the page load without js
POPUP code:
.modalDialog {
position: fixed;
font-family: Arial, Helvetica, sans-serif;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0, 0, 0, 0.8);
z-index: 99999;
opacity: 0;
-webkit-transition: opacity 400ms ease-in;
-moz-transition: opacity 400ms ease-in;
transition: opacity 400ms ease-in;
pointer-events: none;
}
.modalDialog:target,.modalDialog:hover {
opacity: 1;
pointer-events: auto;
}
.modalDialog>#__spookyPopup {
width: 400px;
position: relative;
margin: 10% auto;
padding: 5px 20px 13px 20px;
border-radius: 10px;
background: #fff;
background: -moz-linear-gradient(#fff, #999);
background: -webkit-linear-gradient(#fff, #fff);
background: -o-linear-gradient(#fff, #999);
}
.profile_container {
height: 160px;
width: 400px;
background: #;
display: inline-block;
}
.profile_div {
height: 120px;
width: 130px;
margin-top: 20px;
margin-left: 130px;
background: #ddd;
border: 1px solid grey;
}
.head_div {
min-height: 12px;
width: 100%;
}
.priv_cont {
height: 90px;
width: 400px;
background: #;
display: inline-block;
}
.priv_head {
height: 60px;
width: 330px;
margin-left:30px;
margin-top:15px;
background: #;
}
.clicker {
display: inline-block;
width: 100px;
height: 50px;
background-color: ;
color: #FFF;
}
.clicker:hover{border-bottom: 2px solid red ;
}
#click_styling
{
margin-top:20px;
height: 50px;
width: 197px;
text-align:center;
font-size:20px;color:#000;
line-height:50px;
text-decoration:none;
cursor:default;"
}
.clicker.hidden {
display: none;
}
.hiddendiv {
height: 0px;
background-color: green;
overflow: hidden;
transition: height 0.5s;
}
.social {
height: 160px;
width: 400px;
background: #ccc;
display: inline-block;
}
.social_link {
height: 60px;
width: 330px;
margin-left:30px;
margin-top:15px;
background: #ddd;
border: 1px solid grey;
}
.hiddendiv.nr2 {
background-color: red;
}
#showdiv1:target~div a[href="#showdiv1"],
#showdiv2:target~div a[href="#showdiv2"] {
display: none;
}
#showdiv1:target~div a[href="#hidediv1"],
#showdiv2:target~div a[href="#hidediv2"] {
display: inline-block;
}
#showdiv1:target~div .hiddendiv.nr1,
#showdiv2:target~div .hiddendiv.nr2 {
height: 150px;
}
Open Modal
<div id="__spooky_auth_popup" class="modalDialog">
<div id="__spookyPopup">
X
<div class="profile_container">
<div class="profile_div"></div>
</div>
<div class="head_div">
<p style="margin:0;padding:0;text-align:center;
font-size:25px;color:#8d8686;">
<I>Hey, please login to access your private content.</I>
</p>
</div>
<div id="showdiv1"></div>
<div id="showdiv2"></div>
<div>
SOCIAL
SOCIAL
MANUAL
MANUAL
<div class="hiddendiv nr1">
<div class="social">
<div class="social_link">
<div data-html="allow" >
<iframe id="iFrame1" style="border: 0px; display: block" height="400" class="spoooky-auth" src="https://api.spooo.ky/auth/facebook" border="0"></iframe>
</div>
<!-- End of facebook button -->
</div>
<div class="social_link">
<!-- Optional: Linkedin button starts here -->
<div data-html="allow" >
<iframe style="border: 0px; display: inline-block" class="spoooky-auth" src="https://api.spooo.ky/auth/linkedin" border="0"></iframe>
</div>
<!-- End of linkedin button -->
</div>
</div>
</div>
<div class="hiddendiv nr2">y</div>
</div>
<div class="priv_cont">
<div class="priv_head"><p style="margin:0;padding:0;text-align:center;font-size:18px;color:#000;">
<I>By continuing to the content you agree with the cookie
and privacy policies.</I> </p>
</div>
</div>
Any Idea?what was the issue?
Any input is apprecheated.
Thanks in Advance.
It appears your modalDialog box by default has an opacity of zero. Upon hovering it the opacity goes to one. Everything else is also nested in this div that upon no longer hovering the div, it all disappears.
.modalDialog {
position: fixed;
font-family: Arial, Helvetica, sans-serif;
top: 0;
right: 0;
bottom: 0;
left: 0;
background: rgba(0, 0, 0, 0.8);
z-index: 99999;
opacity: 0;
-webkit-transition: opacity 400ms ease-in;
-moz-transition: opacity 400ms ease-in;
transition: opacity 400ms ease-in;
pointer-events: none;
}
.modalDialog:target,.modalDialog:hover {
opacity: 1;
pointer-events: auto;
}
This question already has answers here:
Keep the middle item centered when side items have different widths
(12 answers)
Closed 5 years ago.
My title is being centered inside the flex box content area of my webpage. It's about 30 pixels to the right. Should I change the dimensions of the flex box? If so, how? Advice is greatly appreciated!
a {
outline: 0;
}
body {
background: linear-gradient(to bottom, #1D4350, #A43931);
background-attachment: scroll;
font-family: 'PT Mono', monospace;
}
html,
body,
.wrapper {
max-width: 100%;
min-height: 100%;
min-width: 960px;
margin: 0 auto;
}
.wrapper {
position: relative;
}
.content {
height: 1200px;
}
.header {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: space-between;
}
.Octagon {
color: #2aa186;
line-height: 30%;
margin-top: 25px;
}
.LT {
color: #3a5454;
line-height: 0;
font-style: italic;
text-align: center;
position: relative;
bottom: 33px;
}
.boi {
position: relative;
cursor: pointer;
margin-right: 30px;
padding: 8px 18px;
border: 1px solid #204156;
border-color: #52AEC9;
color: #52AEC9;
transition-duration: 0.25s;
transition-timing-function: ease-in-out;
border-top-left-radius: 15px;
border-bottom-left-radius: 15px;
}
.iob {
position: relative;
cursor: pointer;
margin-left: 30px;
padding: 8px 18px;
border: 1px solid #204156;
border-color: #52AEC9;
color: #52AEC9;
transition-duration: 0.25s;
transition-timing-function: ease-in-out;
border-top-right-radius: 15px;
border-bottom-right-radius: 15px;
}
.boi:active,
.iob:active {
top: 3px;
}
.boi:hover,
.iob:hover {
text-shadow: 0 0 10px #a193ff;
}
.manyarms,
.colorful {
position: absolute;
margin-top: 30px;
margin-left: 30px;
}
.A1 img {
-webkit-transition: all 0.75s ease-in-out;
-moz-transition: all 0.75s ease-in-out;
-ms-transition: all 0.75s ease-in-out;
-o-transition: all 0.75s ease-in-out;
transition: all 0.75s ease-in-out;
}
.manyarms,
.A1:hover .colorful {
-webkit-opacity: 1;
-moz-opacity: 1;
opacity: 1;
}
.A1:hover .manyarms,
.colorful {
-webkit-opacity: 0;
-moz-opacity: 0;
opacity: 0;
}
.A2 img {
-webkit-transition: all 0.75s ease-in-out;
-moz-transition: all 0.75s ease-in-out;
-ms-transition: all 0.75s ease-in-out;
-o-transition: all 0.75s ease-in-out;
transition: all 0.75s ease-in-out;
}
.sensible,
.A2:hover .BlueBoi {
-webkit-opacity: 1;
-moz-opacity: 1;
opacity: 1;
}
.A2:hover .sensible,
.BlueBoi {
-webkit-opacity: 0;
-moz-opacity: 0;
opacity: 0;
}
.sensible,
.BlueBoi {
margin-top: 30px;
margin-right: 20px;
right: 10px;
position: absolute;
}
.VS {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: space-between;
}
.verr {
padding-left: 31px;
padding-top: 263px;
}
.special {
padding-right: 71px;
padding-top: 263px;
}
.footer {
bottom: 0;
left: 0;
margin-right: 10px;
position: fixed;
text-align: right;
width: 100%;
}
<div class="wrapper">
<div class="header">
<a href="https://www.google.com/?gws_rd=ssl" target="_blank" style="text-decoration: none;">
<p class="iob">Information</p>
</a>
<h1 class="Octagon">The Pragmatic Octopus</h1>
<a href="https://www.google.com/?gws_rd=ssl" style="text-decoration: none;" target="_blank">
<p class="boi">Contact</p>
</a>
</div>
<p class="LT">Certes</p>
<div class="content">
<div class="A1">
<img src="https://s32.postimg.org/406x38nlh/imageedit_1_3827627792.jpg" alt="hecc" style="width:310px; height:250px;" class="manyarms">
<img src="https://s-media-cache-ak0.pinimg.com/736x/de/71/29/de71292c5df818b418fe09cbca9c49c2.jpg" alt="hecc2" style="width:310px; height:250px;" class="colorful">
</div>
<div class="A2">
<img src="http://www.wonderslist.com/wp-content/uploads/2014/07/Blue-ringed-octopus.jpg" alt="hecc3" style="width:310px; height:250px;" class="sensible">
<img src="http://img03.deviantart.net/a0a6/i/2010/007/6/4/octopus_by_mnk7.jpg" alt="hecc4" style="width:310px; height:250px;" class="BlueBoi">
</div>
<div class="VS">
<p style="color: #6458b7;" class="verr">Here comes a very special boi!</p>
<p style="color:#6458b7;" class="special">He loves to pose for photos!</p>
</div>
</div>
<div class="footer">
©Hecc™®
</div>
</div>
Here's the code you're using to align your flex items:
.header {
display: flex;
flex-direction: row;
flex-wrap: nowrap;
justify-content: space-between;
}
With space-between the "Information" and "Contact" elements will be positioned at opposite edges of the container.
Because a flex container aligns items based on the distribution of free space, your middle item will be centered between them, not necessarily centered on the page.
With "Information" having a computed width of 174px, and "Contact" having a computed width of 135px, the middle item is off-center by 39px.
In order for the middle item to be centered on the page, its siblings would need to be equal width, so there is an equal balance of space on both sides.
The following post has two methods for centering items in a flex container when siblings vary in size:
Methods for Aligning Flex Items along the Main Axis (see box #71)