Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I would like to realize a simple tutorial to explain the role of the specific areas of my website realised with popovers.
My idea is that when user clicks on the button start tutorial, then some popovers are displayed in sequence on different elements, and when a popover is open, the rest of the screen is blocked and the user can only press next to close the current popover and open the following one, until the tutorial is concluded.
How can i do that?
When the modal is open, you have to use JS to temporarily add overflow:hidden to the body element (this will remove the scroll bars on the main window and prevent scrolling.)
The markup to manage this class toggle on the body has already been answered/provided here:
How to disable scrolling temporarily?
If you just require the user not to be able to click anywhere else, other than in the tutorial, you can make a simple overlay like so (View snippet in full screen):
html,
body {
overflow: hidden
}
.block {
height: 100vh;
width: 100vw;
background: black;
opacity: 0.8;
position: absolute;
top: 0;
left: 0;
}
.tutorial {
height: 300px;
width: 800px;
background: #ccc;
position: absolute;
top: 50vh;
left: 50vw;
transform: translateX(-50%) translateY(-50%);
}
iframe {
height: 100vh;
width: 100vw;
}
<iframe src="http://autotrader.com" frameborder="0" scrolling="no"></iframe>
<div class="block">
</div>
<div class="tutorial">
</div>
Related
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
Stumbled upon this example on the web
https://redq.io/react-next-landing
So how is this effect called that the main slider seems to be unmovable and the rest of the body covers it while scrolling?
It's actually position: fixed. Fixed removes the element from the normal document flow which sticky does not. For this to proberly work the scrolling part has to be "above" the top part. Which is done with z-index: int as you can see in the following screenshot:
You can read more about in the link shared by Roko.
It's called sticky
Achieved using CSS position: sticky; and top: /*i.e:*/ 0px; you can find more info here:
https://developer.mozilla.org/en-US/docs/Web/CSS/position
If the element was just to move at a different pace (slower then the rest of the document scroll) than it would be called: parallax.
Sticky slideshow example:
/* Quick Reset */ * {margin:0; box-sizing: border-box;}
header,
main,
footer {
position: relative;
display: flex;
justify-content: center;
align-items: center;
}
header {min-height: 100vh; background: gold; position: sticky; top: 0; }
main {min-height: 100vh; background: white;}
footer {min-height: 50vh; background: grey;}
<header><h1>ABOVE THE FOLD SLIDESHOW</h1></header>
<main><div>MAIN CONTENT</div></main>
<footer><div>Footer links etc</div></footer>
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
In React on a button click I make a small component (compSmall) visible on top of another big component (compBig). using css properties on compSmall such as
position: absolute;
width: 300px;
height: 150px;
margin-left: 40%;
margin-top: 200px;
border: 1px solid #0083a5;
z-index: 100;
But when compSmall is visible on top of compBig, background (means content of compBig) still visible . But I want content of compBig is to be not visible clear or blur when compSmall is visible.
How to achieve this.
PS:
I can only apply properties on compSmall, not on CompBig. Since CompBig is the whole application component except compSmall.
What about make compSmall with the same size of compBig, so you will not see the compBig and inside the compSmall you can create another component or just a div with those css properties.
JSX
<CompBig>
<CompSmall className="compSmall">
<div className="content"></div>
</CompSmall>
</CompBig>
CSS
.content {
position: absolute;
width: 300px;
height: 150px;
margin-left: 40%;
margin-top: 200px;
border: 1px solid #0083a5;
z-index: 100;
}
.compSmall {
/* Add the blur effect */
filter: blur(8px);
height: 100%;
width: 100%
}
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I have a div in which, I need to display the div as shown in the image below.
Can we acheive this using css or with any script. Need help
Thanks
Use perspective and transform: rotate.
If you take a look at this link, perspective, you'll find some interesting things one can do
div {
margin-top: 40px;
perspective: 100px;
}
img {
height: 150px;
transform: rotateY(15deg);
}
<div>
<img src="http://lorempixel.com/500/200/nature/1/" alt="">
</div>
This is basic idea.
.parent {
perspective: 600px;
}
.child {
width: 100px;
margin: auto;
height: 35px;
text-align: center;
background: red;
transform: perspective(500px) rotateY(35deg);
}
<div class="parent">
<div class="child">Banners</div>
</div>
Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 8 years ago.
Improve this question
Following on from another SO question.
Is it possible to expand the div, left and right instead of the answers on the other SO question which only expand to the right and down...
cheers
Of course it is.
Structure
You need a parent container set to position: relative; and your actual div set to position: absolute;
This way you can modify position of your div without any worry. This should work as a starting point. You can see the child div being shifted top and left compared to the parent.
<style>
.parent {
position: relative;
width: 200px;
height: 200px;
background: yellow;
margin: 40;
}
.child {
position: absolute;
top: -10px;
left: -10px;
width: 100px;
height: 100px;
background: red;
}
</style>
<div class="parent">
<div class="child">
</div>
</div>
Expansion
so for the actual expansion, you would have to animate / change the left / top position together with width and height of the box.
For every 1px you shift your box left, you have to increase its width by 2px! to get an even expansion.
$('.child').animate({'left' : '-=10px', 'width' : '+=20px'});
How to avoid user to click outside popup window javascript ?
If you want to avoid clicking of the content you can place a div with a fixed position over all the content. That prevents the user from clicking on everything that is not inside this div. I use this for some error reporting on a site.
Html:
<div id="error_wrapper">
<div id="site_error">
Error:
</div>
</div>
Css:
div#error_wrapper {
position: fixed;
width: 100%;
height: 100%;
background-color: #000000;
top: 0px;
left: 0px;
opacity: 0.7;
filter: alpha(opacity=70);
}
div#site_error {
position: fixed;
top: 200px;
width: 400px;
left: 50%;
margin-left: -200px;
}
I think you're asking about a modal dialog box. If so, have a look at the jQuery UI modal dialog.
It will open up a dialog box with custom HTML content, and the rest of the page will be grayed-out and un-clickable. Is that what you want?
If you meant to ask "can you prevent users from clicking outside a popup window", no, you can't. At least not with JavaScript. Just imagine how annoying that would be.
You need "deeper" access to the browser than what a bunch of JavaScript sitting on a webpage has in order to do this.
Just make a popup div follow the cursor with a mousemoveevent! I can see some flaws with the method, though.