Here is my problem. I'm building portfolio page, and now I want to make it easy to navigate for people that can't use the mouse.
What does the outline property do? It provides visual feedback for
links that have "focus" when navigating a web document using the TAB
key (or equivalent). This is especially useful for folks who can't use
a mouse or have a visual impairment. If you remove the outline you are
making your site inaccessible to these people.
I built it so you can navigate all the links on my page using TAB key and you can open that link using ENTER key.
But...
I have nice visual effect with overlay. You can see images of apps, and only when you hover the mouse above that picture you can see links.
So TAB is working and you can select a link using keyboard but you can't see active links, because that overlay effect works only with the mouse (while mouse is hovering above particular picture).
It is hard to explain by words, so I recorded a short video:
https://youtu.be/IQbXL7iyG6w?t=5
Any idea how to fix this? Overlay effect should be tiggered by TAB navigation as well.
GitHub code:
https://github.com/elminsterrr/portfolio
You can do this with a simple jquery code. First change your css
CSS
change this:
#portfolio .inner-content:hover .overlay-content {
top: 0px;
z-index: 1;
background: rgba(0,0,0,0.9);
transition: all 0.5s ease-out;
-webkit-transition: all 0.5s ease-out;
-moz-transition: all 0.5s ease-out;
}
with:
#portfolio .inner-content:hover .overlay-content {
top: 0px;
z-index: 1;
background: rgba(0,0,0,0.9);
}
#portfolio .inner-content .overlay-content.focus_test{
top: 0px;
z-index: 1;
background: rgba(0,0,0,0.9);
}
jQuery:
$('.overlay-content p a').focus(function(){
$(this).parents('.overlay-content').addClass('focus_test');
});
$('.overlay-content p a').blur(function(){
$(this).parents('.overlay-content').removeClass('focus_test');
});
You're showing your overlay on :hover when using TAB the elements get focused, so you have to add the :focus selector to your css for your overlay to show.
.my-class:hover .my-overlay { ... } => .my-class:focus .my-overlay, .my-class:hover .my-overlay { ... }
Related
Using hover with transition ease-in for an image, taking cursor out of the image makes it unpleasant
i've tried :after ,but i'm not sure if thats what i need, if it is , i didn't figure it out (i'm a noob)
this is the code i'm using for hovering
.movies img:hover
{
border: 7px solid white;
padding: 0px;
width: 230px;
transition: all 0.1s ease-in;
}
How to add a transition(or something else to smooth it)to make the new border created by the hover disappear with a transtion ?
I guess you can smooth it (as you named it) by throwing out
transition: all 0.1s ease-in;
to your .movies img class, but I'm not sure if that's the solution you're looking for.
Have you got a codepen project for this problem?
Trying to make userface more userfriendly i want to implement following:
I have a table with some alert above it. Take a look at this example
When I close alert table 'jumps' to the top. I want it to slide smoothly. I want to use pure css. I've read about transition and animation but i think that's not what i need, or maybe i am wrong.
Any ideas? Thanks in advance!
K, so you can do it with pure css. Bootstrap removes the in class from the alert at the beginning of the fade out. We can use that to apply css to the alert before it's removed from the page.
.fade {
max-height: 400px;
-webkit-transition: .3s;
-ms-transition: .3s;
transition: .3s;
}
.fade:not(.in) {
max-height: 0;
}
See it in action: http://jsfiddle.net/McHUc/92/
I'm building a website which is still very much in process, but I'm stuck on something I can't figure out.
The website is currently visible on http://adhoc.fiberspa.nl
I'm developing mobile first, so it looks best if you shrink the browser screen when viewing in a browser.
When you view this in a browser, and click the menu button (top right) a menu slides in. The menu is still unstyled, but the point is that it nicely slides in on top of everything.
If you view the same website on a mobile device using chrome the Menu also slides in, on top of the header, but hides beneath the content. I noticed that it works fine on my mobile on firefox.
From reading I figured out it has something to do with fixed elements having their own z-index stacks.. so I can't use z-index to fix the problem. Possibly I have to change the entire structure of my document but I can't figure it out.
What I have is a page with a fixed header and footer. I somehow want a menu that slides in from the top, appearing over the header and over the content, when clicking the menu button.
I ended up getting a working version of what I was after using JQuery:
I made the menu fixed to the right and above the page on page load.
I used JQuery to calculate the height of the header when the menu button is clicked and move it down to that position, and back up when the button, menu, or page is clicked again.
(function ($) {
Drupal.behaviors.adhocTheme = {
attach: function (context, settings) {
$('#l-navbutton').click(function () {
var menu = $('.l-region--navigation');
menu.css('top', $('.l-header').outerHeight() + "px");
if(!menu.hasClass('show'))
menu.addClass('show');
else
{menu.removeClass('show'); menu.css('top', "0px");}
});
$('.l-region--navigation, .l-main, .l-footer').click(function () {
var menu = $('.l-region--navigation');
if(menu.hasClass('show'))
{menu.removeClass('show'); menu.css('top', "0px");}
});
}
};
}(jQuery));
I added CSS for the slide down animation.
.l-region--navigation{
position: fixed;
top: 0px;
right: 0px;
visibility: hidden;
background-color: #cccccc; // Old browsers
#include filter-gradient(#cccccc, #cccccc, vertical); // IE6-9
#include background-image(linear-gradient(top, #cccccc 0%,#ededed 62%,#cccccc 100%));
transition: 0.5s ease;
-webkit-transition: 0.5s ease;
-moz-transition: 0.5s ease;
#include span (6 of 9);
#include bleed($grid-padding);
}
.l-region--navigation.show{
visibility: visible;
transition: 0.5s ease;
-webkit-transition: 0.5s ease;
-moz-transition: 0.5s ease;
}
I gave my header a z-index of 100 to ensure the menu slides down beneath it and not over it. All in all this works beautifully!
If I did not want it to slide down from beneath the header, but over the header as in my original question, it would now work by having it slide from -200px to 0px, instead of to the header height and removing the z-index from the header. I had that first, but I like this better.
I would like to animate an <a> tag so when in :active state it will move to the right and when going back to regular state it would animate back to the left.
Currently it is animating on click but when I leave the mouse button it jumps back with no animation, how can I reverse the animation?
Here is a simple example, please note that i have to use position:relative;left:20px since in the real app this code is inside an absolutely positioned element and for some reason, using margin causing unexpected behaviour.
Just use left: 0; for a and use position: relative; in a rather than a:active
Demo
CSS
a {
display: block;
background: red;
-webkit-transition: left .2s ease-in,margin .2s ease-in;
-moz-transition: left .2s ease-in,margin .2s ease-in;
transition: left .2s ease-in,margin .2s ease-in;
left: 0;
position: relative;
}
Just a suggestion, moving links on click will annoy the visitors, why not use it on hover
Demo
If your live code is like the example, you just need to put position:relative; and left: 0px; on the a {} rule too.
What is happening is when you stop hovering/release click, it loses the position: relative, because it isn't on the current class. Without the position rule, the left rule is ignored.
How to make images move automatically + on mouseover in CSS/HTML?
For example Ek Main Aur Ekk Tu Movie Site
It's actually really easy to do with CSS3:
.moveMe
{
width: 150px;
height: 40px;
background: #f01;
position: absolute;
top: 0;
-webkit-transition: top 2s;
-moz-transition: top 2s;
-o-transition: top 2s;
}
.moveMe:hover
{
top: 10px;
-webkit-transition: top 0.3s;
-moz-transition: top 0.3s;
-o-transition: top 0.3s;
}
This tells the element onHover to transition between the two states of top over a period of 2 seconds and 0.3 seconds when the mouse leaves.
Check it out here: http://jsfiddle.net/HGjQC/'
As this is a CSS3 technique, the code here will only work in webkit browsers (Chrome, Safari, any other browser using the Chromium engine [Rockmelt]), Opera and Mozilla browsers.
For IE, yoy'll probably need to use Javascript for now until MS decides to implement more CSS3.
It uses something called parallax effect. I found a jquery plugin that seems to help do this kind of effects. The plugin is called Plax, here is the demo
you could make an invisible div, and then use the query .attr() tag to change the image on hover. I'm not sure I get your question though, because I couldn't find the site that wanted to base yours off of.
Maybe you can use JavaScript, like this:
http://jsfiddle.net/HGjQC/2/