linking problema in dropdown menu - html

I added a dropdown menu with flags in my navbar so I'd be able to move to pages in other languages. here's a link to the dev site where I made my test: my dev site
well as you can see the dropdown is there but links are not working...here's the code itself:
<div id="image-dropdown" style=" float: right; position: relative; top: 30px;width: 45px;">
<a href="http://www.uprightpose.com/">
<input checked="checked" type="radio" id="line1" name="line-style" value="1" />
<!--hyperlink to the language page-->
<label for="line1"></label>
</a>
<a href="http://www.uprightpose.com/home-es-new/">
<input type="radio" id="line2" name="line-style" value="2" />
<label for="line2"></label>
</a>
</div>
and here's the css:
<style>
#image-dropdown {
/*style the "box" in its minimzed state*/
width:80px; height:50px; overflow:hidden;
/*animate collapsing the dropdown from open to closed state (v. fast)*/
-moz-transition: height 0.1s;
-webkit-transition: height 0.1s;
-ms-transition: height 0.1s;
-o-transition: height 0.1s;
transition: height 0.1s;
}
#image-dropdown:hover {
height:200px; /*overflow-y:scroll;*/
/*nice and smooth expand - speed this up at your preference or remove animation altogether*/
-moz-transition: height 0.5s;
-webkit-transition: height 0.5s;
-ms-transition: height 0.5s;
-o-transition: height 0.5s;
transition: height 0.5s;
}
#image-dropdown input {
/*hide the nasty default radio buttons. like, completely!*/
position:absolute;top:0;left:0;opacity:0;
}
#image-dropdown label[for="line1"] {
/*style the labels to look like dropdown options, kinda*/
display:none; margin:2px; height:46px; opacity:0.2;
/*setting correct backgrounds - add additional rules with selectors based on "for" attribute, something like label[for=line2]{background-image:...}*/
background:url("https://lipis.github.io/flag-icon-css/flags/4x3/gb.svg");
background-size: 40px;
background-repeat: no-repeat;
border-radius: 7px;
width: 40px;
height: 30px;
}
#image-dropdown label[for="line2"] {
/*style the labels to look like dropdown options, kinda*/
display:none; margin:2px; height:46px; opacity:0.7;
/*setting correct backgrounds - add additional rules with selectors based on "for" attribute*/
background:url("https://lipis.github.io/flag-icon-css/flags/4x3/es.svg");
background-size: 40px;
background-repeat: no-repeat;
border-radius: 7px;
width: 40px;
height: 30px;
}
#image-dropdown:hover label{
/*this is how labels render in the "expanded" state. we want to see only the selected radio button in the collapsed menu, and all of them when expanded*/
display:block;
}
#image-dropdown label:hover {
opacity:0.5;
}
#image-dropdown input:checked + label {
/*tricky! labels immediately following a checked radio button (with our markup they are semantically related) should be fully opaque regardless of hover, and they should always be visible (i.e. even in the collapsed menu*/
opacity:1 !important; display:block;
}
/*pfft, nothing as cool here, just the value trace*/
#trace {margin:0 0 20px;}
</style>
I know that the input is problematic and it doesn't work with links but...I can do it either way...help someone?

You have a radio button element inside the link. When you click it, the element is being selected (because your link has no text in it, when you pressing the flag - you are actually selecting the radio buttons - without any redirection being initiated). Add an onclick event to the input tag which will initiate the redirection:
<input... onclick='window.location="http://www.uprightpose.com/home-es-new/";' />
Here is a working example with your code and an added onclick which will reload jsfiddle onclick:
<a href="http://www.uprightpose.com/">
<input checked="checked" type="radio" id="line1" name="line-style" value="1" onclick='window.location="https://jsfiddle.net/";' />
<!--hyperlink to the language page-->
<label for="line1"></label>
</a>

Related

Chrome autocomplete and transition animation in CSS

I've a semi-complicated user registration form that Google Chrome is ruining. As per design, I've moving/animated placeholder which moves out of input to 20px above it on user focus, and stays there if something is in the field. Come Chrome autocomplete, everything is messed up with email field.
So, I assume focus event is not being invoked on autocomplete, hence everything breaks.
Example on JS fiddle, though I'm not getting autocomplete there: https://jsfiddle.net/dxgou68p/1/
label {
margin:20px 0;
position:relative;
display:inline-block;
}
span {
padding:10px;
pointer-events: none;
position:absolute;
left:0;
top:0;
transition: 0.2s;
transition-timing-function: ease;
transition-timing-function: cubic-bezier(0.25, 0.1, 0.25, 1);
opacity:0.5;
}
input {
padding:10px;
}
input:focus + span, input:not(:placeholder-shown) + span {
opacity:1;
transform: scale(0.75) translateY(-100%) translateX(-30px);
}
<form>
<div class="form-field">
<label>
<input type email placeholder=" ">
<span>Placeholder Text</span>
</label>
</div>
</form>
How can I make it so that autocomplete doesn't rule styling?
EDIT: It is not that color is changed, bur rather span tarnsition efect doesn't do it's thing on autocomplete.
input:-webkit-autofill{
-webkit-text-fill-color: black !important;
-webkit-box-shadow: 0 0 0 30px white inset !important;
}
This should prevent Chrome doing any styling on the inputs
For more info see Removing input background colour for Chrome autocomplete?

How can i make a button clickable after poping up on hoovering an image

So, on hoovering an image, a button appears onto the image, but it is not clickable . The same applies for links or anything inside the div holding the image. I was wondering how i can get over with this.
My html
<div class="content_img">
<img [src]="mydata.image.original" >
<div >
<button type="button"class="btn btn-primary"> Description </button>
</div>
</div>
My Css
/* Parent Container */
.content_img{
position: relative;
width: 90%;
}
/* Child Text Container */
.content_img div{
position: absolute;
bottom: 0;
right: 0;
background:black;
color: white;
margin-bottom: 5px;
font-family: sans-serif;
opacity: 0.7;
visibility: hidden;
-webkit-transition: visibility 0s, opacity 0.5s linear;
transition: visibility 0s, opacity 0.5s linear;
}
/* Hover on Parent Container */
.content_img:hover{
cursor: pointer;
}
.content_img:hover div{
width: 100%;
height: 100%;
visibility: visible;
opacity: 0.75;
}
Can anyone help me out please
What do you mean by that ? I tested the code and <a> tag works. I tested it like follow :
<a href="www.google.com" target="">
<button type="button"class="btn btn-primary">Description</button>
</a>
The button link is clickable. If it is a button, did you set a onclick event so that button call your function?

CSS and HTML only dropdown spoiler

I am trying to create a CSS and HTML drop-down spoiler with open animation.
I started from this
jsfiddle
but margin-top:-100%; doesn't work very well.
margin-top:-100%;
Any solution for smooth animated dropdown container?
You have some error in your CSS. You specified .spoiler > div for show state and only .spoiler for hide state. You should specify the same thing for both and the animation will run smoothly.
.spoilerbutton {
display:block;
margin: 5px 0;
}
.spoiler {
overflow:hidden;
background: #f5f5f5;
}
.spoiler > div {
-webkit-transition: all 0.2s ease;
-moz-transition: margin 0.2s ease;
-o-transition: all 0.2s ease;
transition: margin 0.2s ease;
}
.spoilerbutton[value="Show"] + .spoiler > div {
margin-top:-100%;
}
.spoilerbutton[value="Hide"] + .spoiler > div {
padding:5px;
}
<input class="spoilerbutton" type="button" value="Show" onclick="this.value=this.value=='Show'?'Hide':'Show';">
<div class="spoiler"><div>
PUT CONTENT YOU WISH TO HIDE HERE
PUT CONTENT YOU WISH TO HIDE HERE
PUT CONTENT YOU WISH TO HIDE HERE
PUT CONTENT YOU WISH TO HIDE HERE
PUT CONTENT YOU WISH TO HIDE HERE
PUT CONTENT YOU WISH TO HIDE HERE
</div></div>
By the way You can also animate the max-height instead of margin like this :
.spoilerbutton {
display: block;
margin: 5px 0;
}
.spoiler {
overflow: hidden;
background: #f5f5f5;
}
.spoiler>div {
margin: 5px;
overflow: hidden;
transition: all 1s ease;
}
.spoilerbutton[value="Show"]+.spoiler>div {
max-height: 0;
}
.spoilerbutton[value="Hide"]+.spoiler>div {
max-height: 90px; /*use a big value here*/
}
<input class="spoilerbutton" type="button" value="Show" onclick="this.value=this.value=='Show'?'Hide':'Show';">
<div class="spoiler">
<div>
PUT CONTENT YOU WISH TO HIDE HERE PUT CONTENT YOU WISH TO HIDE HERE PUT CONTENT YOU WISH TO HIDE HERE PUT CONTENT YOU WISH TO HIDE HERE PUT CONTENT YOU WISH TO HIDE HERE PUT CONTENT YOU WISH TO HIDE HERE
</div>
</div>
For smooth animated dropdown container, maybe you can try this :
.spoiler > div {
-webkit-transition: all 0.2s ease-in-out;
-moz-transition: margin 0.2s ease-in-out;
-o-transition: all 0.2s ease-in-out;
transition: margin 0.2s ease-in-out;
}
I hope his help you ! Am I answering your question?

Applying a certain effect to input[type=submit]

I'm using a CSS hover effect on buttons and menu-links. The links work fine because they are anchor tags, while the buttons do not work since they are used in forms as input[type=submit].
The HTML:
<div class="submit">
<span data-hover="Send">
<input type="submit" value="Send">
</span>
</div>
The .submit-wrapper class is used for decoration (as seen in the CSS below), while the span applies the actual hover effect.
The CSS:
.submit /* Need this to hide the second text -- otherwise it will show beneath */ {
overflow: hidden;
}
.submit > span {
position: relative;
display: block;
-webkit-transition: -webkit-transform 0.3s;
-moz-transition: -moz-transform 0.3s;
transition: transform 0.3s;
}
.submit > span::before /* The effect in place */ {
padding-top: 49px;
content: attr(data-hover);
position: absolute;
-webkit-transform: translate3d(0,0,0);
-moz-transform: translate3d(0,0,0);
transform: translate3d(0,0,0);
left: 28px;
top: 0;
letter-spacing: normal;
}
.submit:hover > span, .submit:focus > span /* The actual effect on hover */ {
-webkit-transform: translateY(-100%);
-moz-transform: translateY(-100%);
transform: translateY(-100%);
}
Here's the problem: I cannot click on the button. It shows the default cursor and completely ignores the fact that it's a button (an input submit type). So I have two questions:
1. Is it possible to use an anchor tag instead of an input type="submit"?
2. If not, how do I make the input type="submit" clickable?
For me, when I put that into jsfiddle, I can't click the button because your translate is moving it offscreen. When I remove that I can click the button just fine.
Otherwise, you can use a link that has jQuery attached to it so when it's clicked, submit the form. see http://api.jquery.com/submit/

Hover color overlay that affects multiple elements

Heres where I'm at:
http://codepen.io/qdarkness/pen/FyIJh
Ideally, how I imagine it at least, is when a user hovers over the <a> that the <div>'s "img-holder" and "tag" both have a transition to color, with the "img-holder" showing a "+" in the middle.
I'm suspecting the fact that I have the <img> inside the <div> that it is not working properly, but I am using that div to constrain the img width and height.
I'd prefer not to add additional divs, is this possible by just apply a class, like i attempted to, to the <div>?
HTML:
<li class="b c d">
<a href="" class="link">
<div class="img-holder overlay"><img src="img/test.jpg"></div>
<div class="tag overlay">
<h3>test</h3>
<h4>test</h4>
</div>
</a>
</li>
CSS:
.img-holder {
width: 235px;
height: 195px;
overflow: hidden;
}
.tag {
clear:both;
position:relative;
float:left;
width: 100%;
overflow:hidden;
background-color: #FFF;
text-align: center;
-webkit-transition: 1s;
-moz-transition: 1s;
-ms-transition: 1s;
-o-transition: 1s;
transition: 1s;
}
a:hover .overlay {
background: #909090;
z-index: 301;
}
OK, I THINK I have an understanding of what you want to do...
I've forked your Codepen sketch: http://cdpn.io/uzfrk
Main points are to position the overlay absolute over your image (relative to .link), and then transition opacity to have it appear.
<old example removed>
UPDATED: fresh sketch with cleaned up markup and styling. Simple example for your purposes.
Codepen sketch here: http://cdpn.io/zhBcA
The main point is the direct child selector to target elements related to your container.
figure:hover > figcaption {
background: #ccc;
}
figure:hover > .overlay {
opacity: 0.85;
}
Let me know if this is what you are looking for.
Could this be what you want? It's just a simple approach.
UPDATE:
Covering text area now.
http://codepen.io/anon/pen/tlKCJ