Opacity in a menu, but not on a list - html

I am going to make this short, so it's easy to understand.
This is the scenario:
I am having opacity in the menu (this works)
I am trying to remove the opacity from the popup (last li, #myModal) (this does not work)
Some of the html in the header:
<div id="header_menu">
<label for="show-menu" class="show-menu"><img src=<?php bloginfo('stylesheet_directory'); ?>/img/ikoner/innbokskontroll_nav_menu.png height="15px"></label>
<input type="checkbox" id="show-menu" role="button">
<ul id="menu">
<li>referanser</li>
<li>blogg</li>
<li class="popupp">bestill foredrag!
<div id="myModal" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
</div><!-- End of Modal body -->
</div><!-- End of Modal content -->
</div><!-- End of Modal dialog -->
</div>
</li>
</ul>
</div>
I am sorry if this is a messy HTML. I tried to make it simple to understand here on SO.
The currently CSS which adds opacity to the menu is the following:
#header_menu {
opacity: 0.6;
filter: alpha(opacity=60); /* For IE8 and earlier */
}
To remove the opacity I have tried the following, but it does not work:
#myModal {
opacity: 1;
filter: alpha(opacity=100); /* For IE8 and earlier */
}
.modal-content, .modal-dialog {
opacity: 1;
filter: alpha(opacity=100); /* For IE8 and earlier */
text-align: left;
}
li.popupp {
opacity: 1;
filter: alpha(opacity=100); /* For IE8 and earlier */
}
Could you please help me to find the solution?

Instead of using opacity try to use rgba like below.
#header_menu
{
background-color:rgba(0,0,0,0.7);
}
So this will not affect any child elements. So wherever you want opacity you can use it like above. The only thing you need to give it rgb format.

Related

how to make hover effect last longer even after removing mouse

i am trying to make a home page for my browser
when i hover over stackoverflow many others divs(clickable links) become visible
but when i move my mouse to click over them the hover state is undone and i am unable to click them does anyone can give me general idea of how to deal with it , i want to make the hover affect stay even after removing the house for some time
.wrapper{
border:1px solid red;
}
label#stackoverflow:hover ~ a
{
opacity: 1;
height: auto;}
a{
transition: all 5s ease;
opacity: 0;
height: 0;}
<div class="searchcontainer">
<div class="wrapper">
<label
id="stackoverflow" for="stackoverflow"><img
name="stackoverflowask"
class='selector'
src="./assets/Stack_Overflow_icon.svg"><span
class="stack black">stack</span><span
class="overflow black">overflow</span>
</label></br>
<a href="https://stackoverflow.com/questions/ask">
<label
id="substackoverflow"><span
class="ask black">Ask </span><span class="question black">Question</span>
</label>
</a></br>
<a href="https://stackoverflow.com/questions">
<label
id="substackoverflow"><span
class="see black">See </span><span class="question black">Question</span>
</label>
</a></br>
<a href="https://stackoverflow.com/users/14266024/infinity">
<label
id="substackoverflow"><span
class="look black">Look At </span><span class="question black">Profile</span>
</label>
</a></br>
</div>
</div>
Something along these lines should point you in the right direction.
When the a tag is inside the label tag, you are technically still hovering over the label when your cursor is over it's children.
a.subitem {
opacity: 0;
transition: all 0.5s;
}
label:hover a.subitem {opacity: 1}
<div>
<label>Stackoverflow <a class="subitem" href="#">SomeLink</a></label>
</div>

Clicking on a click box over a full div link?

I have list of to-do tasks, which are made as divs, using the stretched link bootstrap class. Click on the each of the to-do task, opens up a modal with detailed view. However, those divs (to-dos) have checked button which needs to be able to clicked. Right now when you click the checkbox, modal opens and it can't be checked.
Can you help me with this issue?
<div>
<div>
<ul class="list-unstyled list-inline">
<li class="list-inline-item"><div class="checkbox checkbox-success checkbox-single"><input type="checkbox"><label></label></div></li>
<li class="list-inline-item">Name</li>
</ul>
</div>
<a data-toggle="modal" data-target=".to-do-1" data-backdrop="static" data-keyboard="false" class="stretched-link"></a>
</div>
There are 2 options based on information in the question:
either put just the checkbox on a higher z-index than the modal... I did this for the first checkbox where you can check/un-check the checkbox but can't touch the text in the label
or put the checkbox and it's label on a higher z-index than the modal... I did this for the second checkbox where you can select the label text and check/un-check the checkbox
Added a light red color so that it is easy to observe the behavior...
working snippet below:
.myCheckbox,
.complete-checkbox-clickable {
position: relative;
z-index: 21;
}
.stretched-link::after {
position: absolute;
top: 0;
right: 0;
bottom: 0;
left: 0;
z-index: 1;
pointer-events: auto;
content: "";
background-color: rgba(238, 149, 149, 0.23) !important;
}
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.1/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.16.0/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.4.1/js/bootstrap.min.js"></script>
<div>
<div>
<ul class="list-unstyled list-inline">
<li class="list-inline-item">
<div class="checkbox checkbox-success checkbox-single">
<input type="checkbox" class="myCheckbox">
<label>(this is where you should put the label) </label>
</div>
</li>
<li class="list-inline-item">Name</li>
<br/>
<li class="list-inline-item">
<div class="checkbox checkbox-success checkbox-single complete-checkbox-clickable">
<input type="checkbox" class="myCheckbox">
<label>2nd checkbox </label>
</div>
</li>
</ul>
</div>
<a data-toggle="modal" data-target=".to-do-1" data-backdrop="static" data-keyboard="false" class="stretched-link"></a>
</div>

angular material datepicker doesn't open in modal dialog

I have an angular material 2 date-picker implemented in a bootstrap modal form:
<div class="modal-dialog modal-lg">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">{{title}}</h4>
</div>
<div class="modal-body">
<div class="timeline-cal">
<input class="date-field" [mdDatepicker]="picker" placeholder="Choose a date">
<md-datepicker-toggle mdSuffix [for]="picker"></md-datepicker-toggle>
<md-datepicker #picker></md-datepicker>
</div>
<div class="modal-footer">
<button type="button" class="btn grey-btn pull-right" (click)="cancel()">Cancel</button>
</div>
</div>
</div>
However, upon clicking the button, the datepicker wouldn't open in the modal dialog itself but opens in the background. I tried this but didn't help:
.mat-datepicker-content{ z-index: 1200}
try,
::ng-deep .cdk-overlay-container {
z-index: 1200 !important;
}
Or this
/deep/ .cdk-overlay-container {
z-index: 1200 !important;
}
For me this worked:
::ng-deep .cdk-overlay-container {
position: fixed !important;
z-index: 100000 !important; /* set value you need */
}
You have to specify certain position for z-index.
Note: z-index only works on positioned elements (position:absolute,
position:relative, or position:fixed).
CSS z-index # W3Schools
Add this code in the component html file :
<style>
::ng-deep .cdk-overlay-container {
z-index: 2000;
</style>
Hope fully this will resolve the issue !!!

How to close this pure css popup with anywhere or outside click?

Here is the HTML Code, check out this fiddle for full working code -
https://jsfiddle.net/fmqgeqby/
<a class="" href="#popup1">Get a Quote</a>
<div id="popup1" class="myoverlay">
<div class="mypopup">
<h2>REQUEST A PHONE CALL</h2>
<a class="myclose" href="#">×</a>
Is there any possible solution for this to close popup, when user click outside of site?
Sorry the jsfiddle didn't work so I couldn't see it but can you change it to use bootstrap? Bootstrap's modal works very well.
If not, you could mimic some of what they're doing with your own code.
https://www.w3schools.com/bootstrap/bootstrap_modal.asp
One way to go with is using html labels with hidden checkbox. You will need two labels to be able to toggle the checkbox - one outside of the popup and another inside. Not the cleanest solution, but works:
HTML:
<label for="toggle">Get a Quote</label>
<input type="checkbox" id="toggle">
<div id="popup1" class="myoverlay">
<label for="toggle"></label>
<div class="mypopup">
<h2>REQUEST A PHONE CALL</h2>
<a class="myclose" href="#">×</a>
<div class="mycontent">
<p> Hello </p>
</div>
</div>
</div>
CSS:
input[type=checkbox] {
position: absolute;
left: -999em;
}
input[type=checkbox]:checked ~ #popup1 {
visibility: visible;
opacity: 1;
}
#popup1 label {
position: absolute;
top: 0;
left: 0;
right: 0;
bottom: 0;
z-index: 0;
}
Full example here

Img src to a link

Is it possible to make this chili img to a "a href". The function of the pop up is working fine, but there is no "hand", when you hover the picture.
Link to my portfolio
HTML
<img
src="/images/thumbs/image1.jpg"
data-toggle="modal"
data-target="#myModal1"
alt="Trolltunga, Norway"
width="300px"
height="200px"
>
<div id="myModal1" class="modal fade" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-body">
<img src="//placehold.it/1000x600" class="img-responsive">
</div>
</div>
</div>
</div>
JS
function centerModal() {
$(this).css('display', 'block');
var $dialog = $(this).find(".modal-dialog");
var offset = ($(window).height() - $dialog.height()) / 2;
// Center modal vertically in window
$dialog.css("margin-top", offset);
}
$('.modal').on('show.bs.modal', centerModal);
$(window).on("resize", function () {
$('.modal:visible').each(centerModal);
});
img:hover{
cursor: pointer;
}
Add this to your css
You could add this,
img{
cursor:pointer;
}
cursor:pointer indicates that as link. But actually in your codes there is no <a> tag around your image so you can change your cursor property.
Simple use this code in your css.
img:hover{
cursor: pointer;
}