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.
Related
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?
I have been trying to create animation of text appearing/disappearing.
But this is well known problem of animating display property.
I have tried to use opacity and position instead but still no luck.
I don't want to animate this in only one way, I'm just trying to hide one text and show another with arrow animation. But if it is possible to implement this transition in another way, for instance flip, fade or whatever.
Here is my code
HTML
<div class="wrapper">
<nav class="series-navigation">
<div class="series-navigation__container">
<div class="series-navigation__direction series-navigation__direction--previous">
<div class="series-navigation-item series-navigation-item--previous">
<a href="#" class="series-navigation-item__link">
<span class="sop-arrow-left series-navigation-item__icon series-navigation-item__icon--previous"></span>
<span class="series-navigation-item__title series-navigation-item__title--part">Part 1 </span>
<span class="series-navigation-item__title series-navigation-item__title--name">Article name of Part 1</span>
</a>
</div>
</div>
<div class="series-navigation__divider"></div>
<div class="series-navigation__direction series-navigation__direction--next">
<div class="series-navigation-item series-navigation-item--next">
<a href="#" class="series-navigation-item__link">
<span class="series-navigation-item__title series-navigation-item__title--part">Part 3</span>
<span class="series-navigation-item__title series-navigation-item__title--name">Article name of Part 3</span>
<span class="sop-arrow-right series-navigation-item__icon series-navigation-item__icon--next"></span>
</a>
</div>
</div>
</div>
</nav>
</div>
CSS
.sop-arrow-right:before {
content: ">";
}
.sop-arrow-left:before {
content: "<";
}
.wrapper {
margin-top: 1.25em;
overflow: hidden;
font-size: 1.25em;
padding: 1em;
background-color: #fff;
border-radius: 5px;
}
.series-navigation-item__link:hover .series-navigation-item__title--part,
.series-navigation-item__title--name {
visibility: hidden;
opacity: 0;
position: absolute;
}
.series-navigation-item__link:hover .series-navigation-item__title--name,
.series-navigation-item__title--part {
visibility: visible;
opacity: 1;
position: relative;
}
.series-navigation {
text-align: center;
display: block;
width: 100%;
}
.series-navigation__container {
position: relative;
width: 100%;
}
.series-navigation__divider {
position: absolute;
vertical-align: middle;
display: inline-block;
height: 100%;
width: 1px;
background: #52b3d9;
}
.series-navigation__direction {
position: relative;
padding-top: 1.25em;
padding-bottom: 1.25em;
vertical-align: middle;
display: inline-block;
width: 48%;
}
.series-navigation__direction--next {
padding-right: 0.25em;
}
.series-navigation__direction--previous {
padding-left: 0.25em;
}
.series-navigation-item {
display: block;
width: 100%;
}
.series-navigation-item__link {
width: 100%;
}
.series-navigation-item__link:hover .series-navigation-item__icon--next {
margin-right: -0.625em;
margin-left: 0.625em;
}
.series-navigation-item__link:hover .series-navigation-item__icon--previous {
margin-left: -0.625em;
margin-right: 0.625em;
}
.series-navigation-item__title {
font-size: 1em !important;
display: inline-block;
vertical-align: middle;
width: 90%;
}
#media only screen and (max-width: 768px) {
.series-navigation-item__title {
width: 80%;
font-size: 0.875em !important;
}
}
.series-navigation-item__title--part {
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
-o-transition: all 0.5s;
transition: all 0.5s;
}
.series-navigation-item__title--name {
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
-o-transition: all 0.5s;
transition: all 0.5s;
}
.series-navigation-item__icon {
width: 10%;
vertical-align: middle;
display: inline-block;
font-size: 1.4375em !important;
-webkit-transition: all 0.5s;
-moz-transition: all 0.5s;
-o-transition: all 0.5s;
transition: all 0.5s;
}
.series-navigation-item--previous {
padding-left: 0;
text-align: left;
}
.series-navigation-item--previous .series-navigation-item__title {
padding-right: 0.625em;
}
.series-navigation-item--next {
padding-right: 0;
text-align: right;
}
.series-navigation-item--next .series-navigation-item__title {
padding-left: 0.625em;
}
And live example as well https://jsfiddle.net/CROSP/ebztkwx1/14/
As you can see the animation looks ugly (probably because of position property), furthermore this doesn't work in Safari browser (no animation).
I would be grateful for any help or advice how to achieve desired result.
Thanks.
P.S. no JS & poorly supported browser features.
In refrence to: http://meraxcapital.weebly.com/
I'm Attempting to stop the sticky header in a weebly theme for a client but it is driving me nuts here is the basic header css code:
/* Header */
.birdseye-header {
position: fixed;
z-index: 12;
overflow-y: hidden;
width: 100%;
padding: 10px 30px;
box-sizing: border-box;
backface-visibility: hidden;
-webkit-backface-visibility: hidden;
-webkit-transition: all 250ms ease;
-moz-transition: all 250ms ease;
-ms-transition: all 250ms ease;
-o-transition: all 250ms ease;
transition: all 250ms ease;
}
.birdseye-header .container {
display: table;
overflow-y: hidden;
width: 100%;
max-height: 80px;
}
.birdseye-header label.hamburger {
display: none;
}
.birdseye-header .logo {
display: table-cell;
overflow-y: hidden;
margin-right: 30px;
padding: 0;
vertical-align: middle;
line-height: normal;
}
.birdseye-header .logo a {
display: block;
margin-right: 30px;
margin-left: 10px;
color: #ffffff;
text-transform: uppercase;
letter-spacing: 0.03em;
font-family: 'Open Sans', sans-serif;
font-size: 24px;
font-weight: 600;
line-height: normal;
}
.birdseye-header .logo img {
display: block;
overflow: hidden;
max-width: 200px;
max-height: 40px;
}
.birdseye-header .logo #wsite-title {
display: block;
max-width: 400px;
max-height: 40px;
font-family: 'Open Sans', sans-serif;
font-size: 24px;
font-weight: 600;
line-height: normal;
}
I have tried all ~logical~ methods, but any suggestions welcome.
I am also coming across some strife trying to enlarge the logo (same piece of code as above)
I have attempted changing the 'max-width / height elements and while that works with faffing around in inspect element it doesn't when actually implemented!
Thankyou so much in advance!
The goal is to disable the "fixed" position and change it to absolute. If you have access to the styles then I would change them directly from fixed to absolute. If not then you can try overriding what is there with the following:
.birdseye-header, body.page-has-banner.affix .birdseye-header, body.splash-page.affix .birdseye-header {
position: absolute !important;
}
As for the image size... You need to disable or change the max-width and max-height on ".birdseye-header .logo img" selector.
You can try overriding them with the following:
body.page-has-banner .logo img {
max-height: 70px;
max-width: 250px;
}
If I understand correctly you want to stop the header from being fixed to the top of the web page you will have to remove the following:
.birdseye-header {
position: fixed;
}
Also you should remove the height - this some how adds height to the header - I think its in your main_style.css line/30:
body.page-has-banner.affix .birdseye-header, body.splash-page.affix .birdseye-header {
position: fixed;
top: 0;
background: rgba(35, 35, 35, 0.95);
/* height: 60px; */
padding: 10px 30px;
}
I want to center my text in a relative height div which contains an image. I use absolute position but when my text is on two lines, the text is not centered. I've already tried to use a table but it doesn't work due to the img.
HTML:
<div id="hubs">
<h3>Nos Hubs</h3>
<hr>
<a class="thumbnail vignette-hub" href="http://kkw.fr">
<img style="opacity: 0.6;filter: alpha(opacity=60);" alt="AĆ©roport de Nantes" src="http://kkw.fr/uploads/upload-center/nantes-vue-aerienne091501270208.png" width="100%" />
<p class="txt-hub-image">
Hub de</br>Nantes
</p>
</a>
</div>
CSS :
.txt-hub-image {
z-index: 100;
position: absolute;
left: 0px;
top: 50%;
width: 100%;
height: 100%;
text-align: center;
text-decoration: none;
color: white;
font-weight: bold;
font-size: 16px;
}
.vignette-hub {
position: relative;
width: 25%;
min-width: 135px;
}
.thumbnail {
display: block;
padding: 4px;
margin-bottom: 20px;
line-height: 1.42857143;
background-color: #fff;
border: 1px solid #ddd;
border-radius: 4px;
-webkit-transition: border .2s ease-in-out;
-o-transition: border .2s ease-in-out;
transition: border .2s ease-in-out;
}
.thumbnail > img,
.thumbnail a > img {
margin-right: auto;
margin-left: auto;
}
a.thumbnail:hover,
a.thumbnail:focus,
a.thumbnail.active {
border-color: #337ab7;
}
.thumbnail .caption {
padding: 9px;
color: #333;
}
Do you have any ideas ?
There are a few changes required to your snippet to make it automatically work for all dimensions:
p tags by default have a margin-top. If you don't reset it, then absolutely positioning it at 50% would become 50% + margin-top. This needs to be reset.
When you absolutely position an element at top: 50%, the box gets positioned at 50% height of the container and text keeps getting added from that position on. So, to match the center of the text block with the center of the parent, you have to translate the box with the text up by 50% of its own size. This can be done by adding transform: translateY(-50%).
You don't need to add a height: 100% on the p tag and it can be removed.
Note: Using transform method for positioning needs CSS3 support but I assume this shouldn't be a problem because you are already using transition.
If you want to support non CSS3 compatible browsers, have a look at the other approaches mentioned here. I have added a different answer just to explain the first two points I had mentioned above.
.txt-hub-image {
z-index: 100;
position: absolute;
left: 0px;
top: 50%;
width: 100%;
text-align: center;
text-decoration: none;
color: white;
font-weight: bold;
font-size: 16px;
/* added to fix the vertical centering */
margin-top: 0px;
transform: translateY(-50%);
}
.vignette-hub {
position: relative;
width: 25%;
min-width: 135px;
}
.thumbnail {
display: block;
padding: 4px;
margin-bottom: 20px;
line-height: 1.42857143;
background-color: #fff;
border: 1px solid #ddd;
border-radius: 4px;
-webkit-transition: border .2s ease-in-out;
-o-transition: border .2s ease-in-out;
transition: border .2s ease-in-out;
}
.thumbnail > img,
.thumbnail a > img {
margin-right: auto;
margin-left: auto;
}
a.thumbnail:hover,
a.thumbnail:focus,
a.thumbnail.active {
border-color: #337ab7;
}
.thumbnail .caption {
padding: 9px;
color: #333;
}
<div id="hubs">
<h3>Nos Hubs</h3>
<hr>
<a class="thumbnail vignette-hub" href="http://kkw.fr">
<img style="opacity: 0.6;filter: alpha(opacity=60);" alt="AĆ©roport de Nantes" src="http://kkw.fr/uploads/upload-center/nantes-vue-aerienne091501270208.png" width="100%" />
<p class="txt-hub-image">
Hub de</br>Nantes
</p>
</a>
</div>
Here is a demo fiddle as the snippets feature seems to be down.
Change your .txt-hub-image class, top value from 50% to 25%.
I have html and body set to 100% and same with loading-view but loading view doesn't have 100% height.
body {
position: relative;
min-height: 98%;
width: 98%;
display: table;
}
html {
height: 100%;
}
#font-face{
font-family:CaviarDreamsBold;
src:url('CaviarDreamsBold.ttf');
}
/*
**** Circular Selection ****
*/
.CircularSelectionView {
display: block;
position: relative;
}
.CircularSelectionObject {
display: block;
position: absolute;
width: 90px;
height: 90px;
}
.CircularObjectIcon {
width: 100%;
height: 75%;
}
.CircularObjectTitle {
width: 100%;
height: 20%;
text-align: center;
color: black;
}
/*
**** Loading ****
*/
loading-view {
display: block;
width: 100%;
height: 100%;
}
loading-content {
display: block;
opacity: 0;
width: 100%;
height: 100%;
}
.loaderAnimator {
display: block;
position: absolute;
width: 100%;
height: 100%;
left: 0px;
top: 0px;
opacity: 0;
overflow: hidden;
font-family: "Arial", sans-serif;
}
.wordElement {
position: absolute;
padding: 12px;
background-color: #d9975e;
color: white;
text-align: center;
font-size: 18pt;
border-radius: 12px;
}
/*
**** Tab View ****
*/
tab-view {
display: table;
}
tab-bar {
display: table-row;
width: 100%;
height: 36px;
}
.tabBarButton {
height: 100%;
float: left;
background-color: white;
color: #999999;
border-radius: 6px;
margin: 5px 0px;
padding: 3px 0px;
text-align: center;
font-family: CaviarDreamsBold, "Arial", sans-serif;
/*-webkit-transition: background-color 1.0s linear;
-moz-transition: background-color 1.0s linear;
-o-transition: background-color 1.0s linear;
-ms-transition: background-color 1.0s linear;
transition: background-color 1.0s linear;
-webkit-transition: all 1.0s linear;
-moz-transition: color 1.0s linear;
-o-transition: color 1.0s linear;
-ms-transition: color 1.0s linear;
transition: color 1.0s linear;*/
}
tab-content {
display: table-row;
width: 100%;
}
tab-item {
position: relative;
display: block;
width: 100%;
height: 100%;
}
html
<!---->
<loading-view>
<loading-content>
<tool-bar></tool-bar>
<tab-view id="tabView">
<tab-bar></tab-bar>
<tab-content>
<!-- First tab-content will show on page load -->
<tab-item data-title="Meat Pizzas">
<circular-view id="exampleView" data-object-class="exampleObject" data-autoloop-interval="1000 ">
<circular-object data-icon="Resources/ExamplePizza.png">0</circular-object>
<circular-object data-icon="Resources/ExamplePizza.png">1</circular-object>
<circular-object data-icon="Resources/ExamplePizza.png">2</circular-object>
<circular-object data-icon="Resources/ExamplePizza.png">3</circular-object>
<circular-object data-icon="Resources/ExamplePizza.png">4</circular-object>
<circular-object data-icon="Resources/ExamplePizza.png">5</circular-object>
<circular-object data-icon="Resources/ExamplePizza.png">6</circular-object>
<circular-object data-icon="Resources/ExamplePizza.png">7</circular-object>
<circular-object data-icon="Resources/ExamplePizza.png">8</circular-object>
<circular-object data-icon="Resources/ExamplePizza.png">9</circular-object>
<circular-object data-icon="Resources/ExamplePizza.png">10</circular-object>
<!-- Last object in the list is the
first to be featured on page load -->
</circular-view>
</tab-item>
<tab-item data-title="Second Thing">
<div style="width:100%; height:100%; background-color:gray;">
View 2
</div>
</tab-item>
<tab-item data-title="Third Thing">
<div style="width:100%; height:100%; background-color:lightgray;">
View 3
</div>
</tab-item>
</tab-content>
</tab-view>
</loading-content>
</loading-view>
</body>
Your custom element has 100% height of <body>, but you need to make <body> 100% height of <html>.
The problems with your
body {
min-height: 98%;
display: table;
}
are that
min-height has no effect in tables.
percentage height only works if parent has a explicitly specified height (i.e., it doesn't depend on content height), which is not the case with min-height.
Then, you must use
body {
height: 98%;
}
instead of the code above.