Div Appears on Hover - html

This is supposed to be a simple div-appear-on-hover situation, but the div with #1949_neon is just not showing up after I hover on #1949_wrapper.
I am very sure that the div is at the right place, because when I change the visibility to block, it's showing up at the right place.
<div id="1949_wrapper">
<div class="year_line" style="top:170px;">1949</div>
<div class="neon_light" id="1949_neon"></div>
</div>
.neon_light{
position:relative;
top: 0px;
width:250px;
height:650px;
background:#FFFF00;
z-index: 1;
}
#1949_neon {
display: none;
}
#1949_wrapper:hover #1949_neon {
display: block;
}

This can be achieved with css. The issue here is your id's starting with a number. This works.
<div id="wrapper_1949">
<div class="year_line" style="top:170px;">1949</div>
<div class="neon_light" id="neon_1949"></div>
</div>
.neon_light{
position:relative;
top: 0px;
width:250px;
height:650px;
background:#FFFF00;
z-index: 1;
}
#neon_1949 {
display: none;
}
#wrapper_1949:hover #neon_1949 {
display: block;
}

You can't do it just by css.
Change your HTML to
<div id="1949_wrapper" onmouseover="document.getElementById('1949_neon').style.display = 'block';">
<div class="year_line" style="top:170px;">1949</div>
<div class="neon_light" id="1949_neon"></div>
</div>
and your css to:
.neon_light {
position:relative;
top: 0px;
width:250px;
height:650px;
background:#FFFF00;
z-index: 1;
display:none;
}
#1949_neon {
display: none !important;
}
Demo

You can do it using CSS. What is going wrong with your CSS is you are having ID starting with a number which will not work. Here is the working CSS.
.neon_light{
position:relative;
top: 0px;
width:250px;
height:650px;
background:#FFFF00;
z-index: 1;
}
[id='1949_neon'] {
display: none;
}
[id='1949_wrapper']:hover [id='1949_neon'] {
display: block;
}

Related

How to make active a link on an entire picture although there's already another link in a part of it?

I've got a tile containing a title, a category, a link to the category, a picture and a global link to the picture. As it is, this global link is only active in a piece of the picture area. I would like it to be global.
Here is the HTML :
<div id="article">
<div class="block-module">
<a class="view-full-module" href="http://www.cosmos.com/Common/Images/Destinations/machupicchu3.jpg">
<img class="image" src="http://www.cosmos.com/Common/Images/Destinations/machupicchu3.jpg"/>
</a>
<div class="block-about">
<h2 class="block-title">Title</h2>
<span class="block-stats">Category Date</span>
</div>
</div>
</div>
Here is the CSS :
.view-full-module { cursor: pointer; top: 0px; left: 0px; z-index: 2; background: none repeat scroll 0% 0% rgba(31, 32, 33, 0); width: 100%; height: 100%; }
.image { width: 100%; }
.block-module { width: 100%; position:relative; margin:0; padding:0; cursor:pointer; border-radius:10px; z-index:4; }
.block-about { position:absolute; bottom:0; left:0; right:0; padding:4em 1em 1em 1em; background-image:-webkit-linear-gradient(transparent, rgba(0,0,0,0.55), rgba(0,0,0,0.8)); background-image:linear-gradient(transparent, rgba(0,0,0,0.55), rgba(0,0,0,0.8)); }
.block-about a { position:relative; z-index:5; }
.block-title { max-width:100%; margin:0 0 0; color: white !important;font-size:1.625em; }
.block-stats { width:100%; margin-top:0.35714em; font-size:0.875em; color:rgba(255,255,255,0.55) !important; }
.author-link { color:#659dae; }
#article { top:0; margin: 0; padding:20px; -moz-column-gap: 20px; -webkit-column-gap: 20px; column-gap: 20px; -moz-column-width: 260px; -webkit-column-width: 260px; column-width: 260px; }
Here is a demo : http://jsfiddle.net/5qwejk20/4/
One option would be to add pointer-events: none to the element .block-about.
In doing so, you can essentially click through the element:
Updated Example
.block-about {
pointer-events: none;
}
Browser support for the pointer-events property can be found here.
Another option would be to move the anchor element and then absolutely position it relative to the parent in order to take the full dimensions.
The reason you need to move the anchor element in the DOM is because if it wraps the img element, then you can't have your background fading at the bottom since the anchor needs to be positioned above it in order for the click event to work anywhere within the element.
Updated Example
.view-full-module {
cursor: pointer;
position: absolute;
top: 0; right: 0;
bottom: 0; left: 0;
z-index: 2;
}
<div id="article">
<div class="block-module">
<img class="image" src="http://www.cosmos.com/Common/Images/Destinations/machupicchu3.jpg" />
<div class="block-about">
<h2 class="block-title">Title</h2>
<span class="block-stats">Category Date</span>
</div>
<a class="view-full-module" href="http://www.cosmos.com/Common/Images/Destinations/machupicchu3.jpg"></a>
</div>
</div>
As a side note, you may want to add vertical-align: top to the img element in order to remove the gap under it.
Example without the gap
img {
vertical-align: top;
}

How to display block from left to right in css

My problem is that i want to display block from left to right. You can see my current effect and red box what I'm expecting to get.
what I'm doing wrong? as i did tried to use float left on nmenu_drop class.
CSS:
.wraper{
margin-left:10px;
float:left;
position:relative;
}
.notification_dropdown{
height:40px;
margin-right:10px;
float: right;
position:relative;
padding-left: 10px;
width:30px;
}
.nmenu_drop{
width:200px;
height:300px;
background:#FFF;
clear:both;
position:absolute;
margin-top:40px;
float:right;
}
.nmenu_drop{
display: none;
}
.notification_dropdown:hover + .nmenu_drop {
display: block;
background:#4B4B4B;
}
.nmenu_drop:hover {
display: block;
}
.notification_dropdown:hover{
background:#4B4B4B;
}
HTML:
<div class="wraper">
<div class="notification_dropdown">
<i class="fa fa-globe" style="font-size: 21;color: #8a8a8a; margin-top: 9px;"></i>
</div>
<div class="nmenu_drop">
notification
</div>
</div>
Try adding:
.nmenu_drop {
right: 0;
}
You can play with left and transition:
#wrapper{
position: relative; /* Important, we are going to offset to this div*/
}
#menu{
position: absolute;
width: 100%; /* It looks mobile, so I took this */
top: 0;
left: -105%; /* The extra 5% is easy fix to paddings and borders and stuff */
transition: left 0.5s; /* animate it */
}
#menu.Opened{
left: 0; /* position moved back in */
}
All you have to do now is to add a class Opened to it.
I've made a small demo

Navigation bar links are not clickable on website

The links on my site are not clickable.. I built another site earlier this year and made it work how I wanted, so I just copied that code.
<div id="links">
<div class="wrap">
<ul id="navigation">
<li>HOME</li>
<li>FRESHMAN</li>
<li>SOPHOMORE</li>
<li>JUNIOR</li>
<li>SENIOR</li>
</ul>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>
// Document ready shorthand statement
$(function() {
$('.link').click(function() {
var id = $(this).attr('href');
$('html,body').animate({ scrollTop: $(id).offset().top }, 'slow');
// Prevent default behavior of link
return false;
});
});
</script>
</div>
<div id="atlanta1">
</div>
<div id="atlanta2">
</div>
<div id="atlanta3">
</div>
<div id="atlanta4">
</div>
<div id="stoneMountain">
</div>
I have blank divs just because I have them there at specific heights so the links will take me to different heights on the page. This is how I set up the style, for the links and for the divs
<style>
#links {background-color: black;
background-color: rgba(0, 0, 0, 0.9);
color: white;
position: fixed;
top: 0;
left: 0;
width: 100%;
height: 60px;
padding: 0;
margin: 0;
z-index:0}
#navigation {list-style: none; padding: 1; margin: 18px 0px ; color: white; text-align: center;}
#navigation li {display: inline;}
#navigation li #space {margin-right:150px;}
#navigation a {color: inherit; text-decoration: inherit;}
#header, #footer {width:100%; float:left;}
#navigation li + li {
background:url('seperator.gif') no-repeat top left;
padding-left: 10px
}
.wrap {position:relative; margin:0 auto; width:100%;}
#atlanta1 {
position:absolute;
top:0px;
height: 1000px;
z-index: -0
}
#atlanta2 {
position:absolute;
top:1000px;
height: 1000px;
z-index: -0
}
#atlanta3 {
position:absolute;
top:2000px;
height: 1000px;
z-index: -0
}
#atlanta4 {
position:absolute;
top:3000px;
height: 1000px;
z-index: -0
}
#stoneMountain {
position:absolute;
top:4000px;
height: 1000px;
z-index: -0
}
</style>
I've been stuck here for a while and don't really see whats wrong, but the links aren't clickable.
Im not sure what you mean by the links are not clickable.
I mean your divs have no width for a start so its there is no divs for the Javascript to scroll to. I gave them a width and seems to work ok....
Example of giving a width:
#atlanta1 {
position:absolute;
top:0px;
height: 1000px;
width: 100px; // Width!
z-index: -0;
}
Working Example Here
As you can see the links are clickable and work.
Note: I only gave a width to a few.
I think I know what your talking about now, I think its because you are using z-index. Some of the divs are going above the header. You could try something like.
z-index:9999;
Put that in the header or as you have called it #links.
DEMO HERE
Fully working version:
DEMO HERE
Another update:
Right its because of this:
ul li {
list-style:none;
overflow:hidden;
height:1000px;
position: relative;
z-index:-2;
}
See how you are pushing the list behind the header. Set it to 9 or something and it will comeback to the front. You may want to look up what z-index does.
ul li {
list-style:none;
overflow:hidden;
height:1000px;
position: relative;
z-index:9;
}
Working Demo

how to set previous next icons in middle of height of image on hover that image

I was doing previous and next experiments like facebook, as we do a hover on image it will show previous and next icons. I modified the icons a little bit using simple CSS. but only thing i am missing here is the correct position of the navigation div's.
I want them in the middle of image no matter if the image is 600*600 or 1024*800.
i tried these, but didnt make any progress -
var maskHeight = ($('mainOne').height() - 50);
$('#hoverP').css({top:maskHeight}).show();
$('#hoverN').css({top:maskHeight}).show();
here is sample test case, which includes everything related to problem, Please Help.-
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Test</title>
<script src="./jQuery.min.js"></script>
<style>
.imgHover {
display: inline;
position: relative;
}
.imgHover .hoverP {
display: none;
position: absolute;
left: 3px;
top:-200px;
z-index: 2;
}
.imgHover .hoverN {
display: none;
position: absolute;
right: 0px;
top:-200px;
z-index: 2;
}
.prev_big,.next_big {
background-color:rgba(66,28,82,0.4);;
border:2px solid rgba(255,255,255,0.7);
color:#FFF;
font-size:78px;
font-weight:700;
width:30px;
height:200px;
line-height:200px;
-webkit-transition:.4s all;
-moz-transition:.4s all;
-o-transition:.4s all;
transition:.4s all;
text-shadow:0 1px 0 #FFF;
z-index:3;
text-decoration:none;
-moz-transition-duration:.4s;
-webkit-transition-duration:.4s;
-o-transition-duration:.4s;
transition-duration:.4s;
}
.prev_big {
border-bottom-right-radius:15px;
border-top-right-radius:15px;
margin-left:-3px;
padding:0 20px 0 0;
}
.next_big {
border-bottom-left-radius:15px;
border-top-left-radius:15px;
right:0;
padding:0 5px 0 15px;
}
.prev_big:hover,.next_big:hover {
color:#FFF;
background:#732C7B;
padding-top:140px;
padding-bottom:140px;
}
</style>
</head>
<script>
$(function() {
$(".imgHover").hover(
function() {
$(this).children("img").fadeTo(200, 0.95).end().children(".hoverP").show();
},
function() {
$(this).children("img").fadeTo(200, 1).end().children(".hoverP").hide();
}
);
$(".imgHover").hover(
function() {
$(this).children("img").fadeTo(200, 0.95).end().children(".hoverN").show();
},
function() {
$(this).children("img").fadeTo(200, 1).end().children(".hoverN").hide();
}
);
});
</script>
<body>
<div class="imgHover">
<div class="hoverP"><a class="prev_big" href="page1.html" title="View Previous Page"><</a></div>
<img id="mainOne" src="./oneB.jpg" alt="">
<div class="hoverN"><a class="next_big" href="page3.html" title="View --Next-- Page">></a></div>
</div>
</body>
</html>
Why you need jQuery, bunch of styles with filled markup? I've made this from complete scratch and you see if it's useful
Demo
On the other hand you can use transitions for smoothness - Demo
<div class="wrapper">
<img src="http://www.google.co.in/intl/en_ALL/images/logos/images_logo_lg.gif" />
<div class="bar">PreviousNext</div>
</div>
CSS
div.wrapper {
position: relative;
display: inline-block;
}
.bar {
opacity: 0;
background: rgba(25,25,25,.5);
position: absolute;
bottom: 0;
width: 100%;
height: 30px;
line-height: 30px;
}
div:hover .bar {
opacity: 1;
}
.wrapper a {
position: absolute;
}
.wrapper a:nth-of-type(1) {
left: 0;
}
.wrapper a:nth-of-type(2) {
right: 0;
}

Thumbnail rollover with text

I'm using the following CSS code to do a rollover effect with text:
.thumb {
position:relative;
}
.thumb img:hover {
filter:alpha(opacity=0);
-moz-opacity:0;
-khtml-opacity:0;
opacity:0;
}
.thumb:hover {
background:#f00;
}
.thumb span {
z-index:-10;
position:absolute;
top:10px;
left:10px;
}
.thumb:hover span {
z-index:10;
color:#fff;
}
HTML code:
<div class="thumb">
<img src="thumbnail.jpg" />
<span>Text</span>
</div>
Everything is working well except when I hover over the text: the rollover effect disappears and I can see the image again.
Any ideas?
Thanks in advance
I guess that is too much of styles for simple overlay effect, if you are interested to see a demo I've made from scratch than here you go
Demo
HTML
<div class="wrap">
<img src="http://images.google.com/intl/en_ALL/images/logos/images_logo_lg.gif" />
<div class="overlay">Hello This Is So Simple</div>
</div>
CSS
.wrap {
position: relative;
display: inline-block;
}
.overlay {
opacity: 0;
background: rgba(0,0,0,.8);
position: absolute;
width: 100%;
height: 100%;
top: 0;
left: 0;
transition: opacity 1s;
color: #fff;
text-align: center;
}
.wrap:hover .overlay {
opacity: 1;
}