Wanted to know how to make the pop up scroll able.
The content in the pop-up gets clipped in the mobile screen
On desktop it displays well. But on the mobile device only background get scrolled and not the pop-up
.overlay {
position: fixed;
top: 0;
bottom: 0;
left: 0;
right: 0;
background: rgba(0, 0, 0, 0.7);
transition: opacity 500ms;
visibility: hidden;
opacity: 0;
}
.overlay:target {
visibility: visible;
opacity: 1;
}
.popup {
margin: 70px auto;
padding: 20px;
background: #fff;
border-radius: 5px;
width: 30%;
position: relative;
transition: all 5s ease-in-out;
}
.popup .close {
position: absolute;
top: 20px;
right: 30px;
transition: all 200ms;
font-size: 30px;
font-weight: bold;
text-decoration: none;
color: #333;
}
.popup .content {
max-height: 30%;
overflow: auto;
}
#media screen and (max-width: 700px){
.popup{
width: 70%;
}
<span>Full Recipe</span>
<div id="popup" class="overlay">
<div class="popup">
<h3>Foxtail Millet Porridge:</h3>
<a class="close" href="#">×</a>
<div class="content">
<span>Ingredients:</span>
Thank you for your help !
enter image description here
The content had too big of a height and wouldn't allow scrolling.
Here is the Codepen for the full code
.popup {
transform: translateY(-60px); /* moves container up the page */
margin: 70px auto;
padding: 20px;
background: #fff;
border-radius: 5px;
width: 30%;
position: relative;
transition: all 5s ease-in-out;
}
.content {
height: 250px; /* adjust this depending on the size that you want the
container to be */
}
.popup .content {
overflow-y: scroll;
}
Related
So, I've got my own pen on codepen.io using a transition to change the height, and I don't know what's happening. CAN SOMEBODY HELP ME Please? I've got a single clue why but for some reason 1 of them is working?? I'm SUPER confused, this is not like a normal web-developing time to me.. sort of I've tried my best to think of why it might work myself but I've managed to get 0 luck D-:
So I tried this code:
HTML:
<div class="card">
<div class="text">
<h3>A Title</h3>
<p>A Description for the story</p>
</div>
</div>
CSS:
html, body {
margin: 0;
font-family: "Rubik", sans-serif;
width: 100%;
height: 100%;
background: hsl(0, 0%, 10%);
overflow: hidden;
}
.card {
position: relative;
background-image: url("/images/MyImage.png");
background-size: cover;
width: calc(66vw - 4rem);
height: 50vh;
padding: 20px;
border-radius: 1rem;
margin: 2rem;
overflow: hidden;
}
.text {
background: black;
box-shadow: 0 0 2rem 5rem black;
position: absolute;
left: 0;
bottom: 0;
height: auto;
width: inherit;
transition-timing-function: ease;
transition-duration: .5s;
}
.card:hover .text {
height: 3rem;
}
.text h3 {
margin: 0;
position: absolute;
bottom: 1rem;
left: 1rem;
color: white;
transition-timing-function: ease;
transition-duration: .5s;
cursor: default;
}
.card:hover h3 {
position: absolute;
bottom: 50vh;
}
.text p {
position: absolute;
display: none;
bottom: 1rem;
left: 1rem;
color: white;
margin: 0;
transition-timing-function: ease;
transition-duration: .5s;
}
.card:hover .text p {
display: block;
}
h3::selection, p::selection {
background: transparent;
}
can anybody tell me why the paragraph and the text just won't come up with a transition, I gave you everything in case anything isn't supposed to be like that. and by the way the image is a tropical beach with a non-used name by me, I just wanted you to know that there's ACTUALLY an image there just incase it has anything to do with it's children's transitions.
To make transitions you need a starting point and an ending point. However, not all properties "create" a smooth transition, for example from display: none; to display: block; no transition will be created (same from visibility: hidden to visible).
For this reason, if you want to create smooth transitions you have to use properties that allow you to do this. In this case for the p you have to use the opacity, while for the div you can't make a smooth transition from auto to 3rem, so you will be forced to set a height other than auto.
html, body {
margin: 0;
font-family: "Rubik", sans-serif;
width: 100%;
height: 100%;
background: hsl(0, 0%, 10%);
overflow: hidden;
}
.card {
position: relative;
background-image: url("/images/MyImage.png");
background-size: cover;
width: calc(66vw - 4rem);
height: 50vh;
padding: 20px;
border-radius: 1rem;
margin: 2rem;
overflow: hidden;
}
.text {
background: black;
box-shadow: 0 0 2rem 5rem black;
position: absolute;
left: 0;
bottom: 0;
height: .5rem;
width: inherit;
transition-timing-function: ease;
transition-duration: .5s;
}
.card:hover .text {
height: 3rem;
}
.text h3 {
margin: 0;
position: absolute;
bottom: 1rem;
left: 1rem;
color: white;
transition-timing-function: ease;
transition-duration: .5s;
cursor: default;
}
.card:hover h3 {
position: absolute;
bottom: 50vh;
}
.text p {
position: absolute;
opacity: 0;
visibility: hidden;
bottom: 1rem;
left: 1rem;
color: white;
margin: 0;
transition-timing-function: ease;
transition-duration: .5s;
}
.card:hover .text p {
visibility: visible;
opacity: 1;
}
h3::selection, p::selection {
background: transparent;
}
<div class="card">
<div class="text">
<h3>A Title</h3>
<p>A Description for the story</p>
</div>
</div>
I have a map element wrapped inside of a container and I'm trying to change its position to sticky (as opposed to relative). I have text that I would like to scroll over the map as the viewer scrolls down, however when I open up the inspection tools I see the position of the #map element reverts back to relative, despite it being sticky in my actual code. When I change it to sticky in the browser, it works fine. Can someone tell me what I'm doing wrong here
Here is my HTML
<div id="mapContainer" class="container-map">
<div id="map" style="position: sticky;" class="leaflet-container
leaflet-touch leaflet-retina leaflet-fade-anim leaflet-grab leaflet-
touch-drag leaflet-touch-zoom" tabindex="0">
</div>
<div id='sections'>
<div>
<h1>Operation Entebbe</h1>
<p class="text">
<span class="text-decorate">O</span>Sample Text
</p>
</div>
</div>
</div>
Here is my CSS
#mapContainer{
position: relative;
}
#sections{
z-index: 99;
max-width: 100%;
width: 640px;
position: relative;
margin-left: auto;
margin-right: auto;
}
#sections > div{
background: white;
height: 100%;
opacity: .75;
transition: 0.5s;
}
#sections > div p.text {
display: block;
color: #000000;
z-index: 10;
}
#sections > div.graph-scroll-active{
opacity: 1;
}
#map {
margin-left: 40px;
z-index: 3;
width: 500px;
position: -webkit-sticky;
position: sticky;
top: calc(50% - 250px);
}
#map svg {
z-index: 2;
}
#map svg {
-webkit-transition: transition .6s;
-moz-transition: transition .6s;
-ms-transition: transition .6s;
-o-transition: transition .6s;
transition: transition .6s;
}
#media (max-width: 925px) {
#map{
width: 100%;
margin-left: 0px;
float: none;
}
#sections{
width: auto;
position: relative;
margin: 0px auto;
}
#sections > div{
background: rgba(255,255,255,.5);
padding: 10px;
border-top: 1px solid;
border-bottom: 1px solid;
margin-bottom: 80vh;
}
pre{
overflow: hidden;
}
h1{
margin: 10px;
}
}
#map {
width: 1000px;
height: 600px;
margin-left: 140px;
margin-top: 50px;
position: sticky;
}
svg {
position: relative;
}
Any help would be immensely appreciated.
I have this div and I want to show the title when I hover over title div. The problem is that I get the hover effect even if I hover on the edges of the div. So the div is treated as a square and not as a circle when I hover on it. This works pretty well on Firefox but not on Chrome and Safari.
Fiddle: http://jsfiddle.net/roeg629c/2/
Note: I do not want to change the aspect ratio of the image. The image should be 100% of the parent height.
HTML
<div class="video_wrap update" video_name="rikthejmna">
<div class="related img_wrap"><img src="http://img.youtube.com/vi/XyzYVpJGRG8/hqdefault.jpg"></div>
<div class="title">rikthejm na</div>
</div>
CSS
.video_wrap {
width: 232px;
height: 232px;
display: inline-block;
border-radius: 116px;
overflow: hidden;
margin: 10px;
position: relative;
z-index: 2;
}
.img_wrap img {height: 100%}
.related {height: 100%;}
.title {
position: relative;
top: -50px;
left: 0px;
background: #fff;
height: 50px;
opacity: .5;
color: #f8008c;
font-size: 12px;
text-align: center;
line-height: 50px;
overflow: hidden;
cursor: default;
transition: all .5s ease-in;
}
.title:hover {opacity: 1}
Avoid positioning of the .title, and opacity.
.video_wrap{
width: 232px;
height: 232px;
border-radius: 50%;
overflow: hidden;
margin: 10px;
}
.related {
width: 232px;
height: 232px;
position: absolute;
border-radius: 50%;
overflow: hidden;
z-index: -1;
}
.img_wrap img {
height: 100%;
}
.title{
margin: 185px 0 0;
background: rgba(255,255,255,.5);
line-height: 50px;
text-align: center;
transition: all .5s ease-in;
}
.title:hover{
background: #fff;
}
<div class="video_wrap update">
<div class="related img_wrap"><img src="http://img.youtube.com/vi/XyzYVpJGRG8/hqdefault.jpg"></div>
<div class="title">
rikthejm na
</div>
</div>
I need my slider box to be about 5 times bigger and I have no idea how to do it. How do I go about making the slider box bigger? I did not want to use jQuery so I am only using CSS and HTML . I have tried increasing the width but that has not helped anything
h1 {color:#333; text-shadow:1px 1px #999; font-size:40px; margin:40px; text-align:center;}
.slider {
display: block;
/*min and max changes size of slider?*/
height: 320px;
min-width: 260px;
max-width: 640px;
margin: auto;
margin-top: 20px;
position: relative;
}
.sliderinner {
width: 100%;
height: 100%;
overflow: hidden;
position: relative;
}
.sliderinner>ul {
list-style: none;
height: 100%;
width: 500%;
overflow: hidden;
position: relative;
left: 0px;
}
.sliderinner>ul>li {
width: 20%;
height: 320px;
float: left;
position: relative;
}
.sliderinner>ul>li>img {
margin: auto;
height: 100%;
}
.slider input[type=radio] {
position: absolute;
left: 50%;
bottom: 150px;
z-index: 100;
visibility: hidden;
}
.slider label {
position: absolute;
left: 50%;
bottom: -45px;
z-index: 100;
width: 12px;
height: 12px;
background-color:#ccc;
-webkit-border-radius: 50%;
-moz-border-radius: 50%;
border-radius: 50%;
cursor: pointer;
-webkit-box-shadow: 0px 0px 3px rgba(0,0,0,.8);
-moz-box-shadow: 0px 0px 3px rgba(0,0,0,.8);
box-shadow: 0px 0px 3px rgba(0,0,0,.8);
-webkit-transition: background-color .2s;
-moz-transition: background-color .2s;
-o-transition: background-color .2s;
transition: background-color .2s;
}
.slider input[type=radio]#control1:checked~label[for=control1] { background-color: #333; }
.slider input[type=radio]#control2:checked~label[for=control2] { background-color: #333; }
.slider input[type=radio]#control3:checked~label[for=control3] { background-color: #333; }
.slider input[type=radio]#control4:checked~label[for=control4] { background-color: #333; }
.slider input[type=radio]#control5:checked~label[for=control5] { background-color: #333; }
.slider label[for=control1] { margin-left: -36px }
.slider label[for=control2] { margin-left: -18px }
.slider label[for=control4] { margin-left: 18px }
.slider label[for=control5] { margin-left: 36px }
.slider input[type=radio]#control1:checked~.sliderinner>ul { left: 0 }
.slider input[type=radio]#control2:checked~.sliderinner>ul { left: -100% }
.slider input[type=radio]#control3:checked~.sliderinner>ul { left: -200% }
.slider input[type=radio]#control4:checked~.sliderinner>ul { left: -300% }
.slider input[type=radio]#control5:checked~.sliderinner>ul { left: -400% }
.description {
position: absolute;
bottom: 0;
left: 0;
width: 100%;
z-index: 1000;
}
.description-text {
background-color: rgba(0,0,0,.8);
padding:10px;
top: 0;
z-index: 4;
-webkit-transition: opacity .2s;
-moz-transition: opacity .2s;
-o-transition: opacity .2s;
transition: opacity .2s;
color: #fff;
}
.slider {
display: block;
/*min and max changes size of slider?*/
height: 320px;
min-width: 260px;
max-width: 640px;
margin: auto;
margin-top: 20px;
position: relative;
}
The above code does not set a fixed height/width, so it will most likely inherit it's size based on it's content. To set a fixed height and width: change your code to the following:
.slider {
display: block;
/*min and max changes size of slider?*/
height: 320px;
min-width: 260px;
max-width: 640px;
height: //specified height
width: //specified width
margin: auto;
margin-top: 20px;
position: relative;
}
Code added:
height: //specified height
width: //specified width
EDIT:
I now see that you have a fixed height in there. To make it bigger, just increase your height and/or add a fixed width.
I need to center horizontally a button with aboslute position (because it must keep on top when to click and launch overlay and click to close overlay) on a position fixed topbar, here is the code:
.topbar {
text-align: center;
min-width: 100%;
height: 50px;
background-color: #29343a;
position: fixed;
top: 0;
}
.button {
display: inline-block;
margin-right: auto;
margin-left: auto;
width: 60px;
height: 50px;
cursor: pointer;
background-color: #00c1e2;
border-bottom: 2px solid #00a8c6;
z-index: 100;
position: absolute;
}
.overlay {
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
background: rgba(153,204,51,0.9);
}
Thats is just the css of the three parts, the website is more complex but i think that 3 parts are the key. the topbar must be fixed on top, the buton have to be centered into the topbar div, and the overlay launch and the buttop keeps on top of the overlay.
What is working: the overlay works fine and the button keeps on top but its not horizontally centered on the topbar.
How i can hack this?
You could to the left:0 and right:0 trick.
.button {
display: inline-block;
margin-right: auto;
margin-left: auto;
width: 60px;
height: 50px;
cursor: pointer;
background-color: #00c1e2;
border-bottom: 2px solid #00a8c6;
z-index: 100;
position: absolute;
left: 0; /*added*/
right: 0; /*added*/
}
Or do the left:50% with negative left margin (half width).
.button {
display: inline-block;
width: 60px;
height: 50px;
cursor: pointer;
background-color: #00c1e2;
border-bottom: 2px solid #00a8c6;
z-index: 100;
position: absolute;
left: 50%; /*added*/
margin-left: -30px; /*added*/
}
Or use CSS3 transform.
.button {
display: inline-block;
width: 60px;
height: 50px;
cursor: pointer;
background-color: #00c1e2;
border-bottom: 2px solid #00a8c6;
z-index: 100;
position: absolute;
left: 50%; /*added*/
transform: translateX(-50%); /*added*/
}
Based on the information you provided this is what I could come up with:
/* CSS */
.topBar {
position:fixed;
top:0;
left:0;
width:100%;
height:auto;
background-color:#29343a;
}
.overlay {
display:none;
width: 100%;
background: rgba(153,204,51,0.9);
margin:0;
}
.button, .button:active, .button:visited, .button:hover {
display: block;
position:relative;
text-align:center;
cursor: pointer;
background-color: #00c1e2;
border-bottom: 2px solid #00a8c6;
margin:0 auto;
padding:10px;
}
.topBar:hover > .overlay {
display:block;
}
And I added some html because you didn't provide any:
<!-- HTML -->
<div class="topBar">
Button
<div class="overlay">
<p>Some text shows when button hover</p>
</div>
</div>
JSFIDDLE: https://jsfiddle.net/0napm6y3/
Here is the complete code of this component made on react:
This is the react component, the overlay launch is the overlay var, the other one is for one animation on the button:
var React = require('react');
var StatusBarButtonView = React.createClass({
getInitialState: function() {
return {cliked: false};
},
handleClick: function(event) {
this.setState({cliked: !this.state.cliked});
},
render: function() {
var fondo = this.state.cliked ? 'active' : '';
var overlay = this.state.cliked ? 'open' : '';
return (
<div>
<div className={"aui-profit-statusbar-button-container " + (fondo)} onClick={this.handleClick}>
<img src="images/aui-navbar-element-icon-cross.png" className={"rotate " + (fondo)}/>
</div>
<div className={"overlay overlay-slidedown " + (overlay)}>
<nav>
<ul>
<li>Home</li>
<li>About</li>
<li>Work</li>
<li>Clients</li>
<li>Contact</li>
</ul>
</nav>
</div>
</div>
);
}
});
module.exports = StatusBarButtonView;
Here is the topbar scss:
.aui-profit-statusbar-container {
text-align: center;
min-width: 100%;
height: 50px;
background-color: #29343a;
position: fixed;
top: 0;
}
Here is the button scss:
.aui-profit-statusbar-button-container {
display: inline-block;
margin-right: auto;
margin-left: auto;
width: 60px;
height: 50px;
cursor: pointer;
background-color: #00c1e2;
border-bottom: 2px solid #00a8c6;
z-index: 100;
position: absolute;
left: 0;
right: 0;
&:hover {
background-color: #56d9f6;
}
&.active {
background-color: #ff4b39;
border-bottom: 2px solid #e43f30;
}
.rotate {
margin-top: 13px;
width: 23px;
height: 23px;
-webkit-transition-duration: 0.2s;
-moz-transition-duration: 0.2s;
-ms-transition-duration: 0,2s;
-o-transition-duration: 0.2s;
transition-duration: 0.2s;
-webkit-transition-property: -webkit-transform;
-moz-transition-property: -moz-transform;
-ms-transition-property: -ms-transform;
-o-transition-property: -o-transform;
transition-property: transform;
}
.active {
-webkit-transform: rotate(135deg);
-moz-transform: rotate(135deg);
-ms-transform: rotate(135deg);
-o-transform: rotate(135deg);
transform: rotate(135deg);
}
}
Here is the overlay css:
/* Overlay style */
.overlay {
position: fixed;
width: 100%;
height: 100%;
top: 0;
left: 0;
background: rgba(153,204,51,0.9);
}
/* Overlay closing cross */
.overlay .overlay-close {
width: 80px;
height: 80px;
position: absolute;
right: 20px;
top: 20px;
overflow: hidden;
border: none;
background: url(../img/cross.png) no-repeat center center;
text-indent: 200%;
color: transparent;
outline: none;
z-index: 100;
}
/* Menu style */
.overlay nav {
text-align: center;
position: relative;
top: 50%;
height: 60%;
-webkit-transform: translateY(-50%);
transform: translateY(-50%);
}
.overlay ul {
list-style: none;
padding: 0;
margin: 0 auto;
display: inline-block;
height: 100%;
position: relative;
}
.overlay ul li {
display: block;
height: 20%;
height: calc(100% / 5);
min-height: 54px;
-webkit-backface-visibility: hidden;
backface-visibility: hidden;
}
.overlay ul li a {
font-size: 54px;
font-weight: 300;
display: block;
color: #fff;
-webkit-transition: color 0.2s;
transition: color 0.2s;
}
.overlay ul li a:hover,
.overlay ul li a:focus {
color: #e3fcb1;
}
/* Effects */
.overlay-slidedown {
visibility: hidden;
-webkit-transform: translateY(-100%);
transform: translateY(-100%);
-webkit-transition: -webkit-transform 0.4s ease-in-out, visibility 0s 0.4s;
transition: transform 0.4s ease-in-out, visibility 0s 0.4s;
}
.overlay-slidedown.open {
visibility: visible;
-webkit-transform: translateY(0%);
transform: translateY(0%);
-webkit-transition: -webkit-transform 0.4s ease-in-out;
transition: transform 0.4s ease-in-out;
}
#media screen and (max-height: 30.5em) {
.overlay nav {
height: 70%;
font-size: 34px;
}
.overlay ul li {
min-height: 34px;
}
}
Now it works perfectly, thanks to all.
Next thing i have to do is separate overlay of buttom component. and keep it running, but im wondering to to pass the action to one component to another.... i have to learn more about react.js