Overflow:hidden effecting zoom image - html

I'm creating a slider where .slider-wrap is a parent div which has rule overflow: hidden; and I want my every image should zoom in whenever I hover on div slider-boxes everything is working fine until I'm using overflow: hidden; but when I start to use overflow: hidden; image doesn't zoom out as the Desired Result in Snippet 2 where I'm not using overflow: hidden;
I want my final result like Snippet 2
But I think overflow is important to use because there will be more images come when I will make it dynamic so is there any way to fix this issue.
here is the jsfiddle https://jsfiddle.net/rhulkashyap/7g3vypqh/
Snippet 1: I'm Getting
body{
background-color: #DD3735;
padding-top:30px;
}
.slider-wrap{
width:616px;
height:120px;
border:1px solid #ccc;
margin:0 auto;
box-shadow: 0 0 10px #000;
border-radius:5px;
overflow:hidden;
}
img, .slider-boxes{
width:120px;
height:120px;
}
.slider-boxes{
display: inline-block;
-webkit-transition: all .2s ease-in-out;
transition: all .2s ease-in-out;
}
.slider-boxes:hover{
-webkit-transform: scale(1.30);
transform: scale(1.30);
box-shadow: 0 0 10px #000;
}
<div class="slider-wrap">
<div class="slider-boxes"><img src="https://pbs.twimg.com/profile_images/378800000108340114/a586d7a8df39836a114651aef74cd2d0_400x400.jpeg" alt="Image1"></div>
<div class="slider-boxes"><img src="https://s-media-cache-ak0.pinimg.com/736x/77/06/4e/77064e4e9ccc289ee5394dd7dbf48011.jpg" alt="Image2"></div>
<div class="slider-boxes"><img src="http://gloimg.gearbest.com/gb/2014/201411/goods-img/1415993980392-P-2179386.jpg" alt="Image3"></div>
<div class="slider-boxes"><img src="https://pbs.twimg.com/profile_images/378800000451012500/4628fbb9dc70514d389ed9491243866f_400x400.png" alt="Image4"></div>
<div class="slider-boxes"><img src="http://howtodrawdat.com/wp-content/uploads/2014/01/1st-pic-Dave-Minion-from-despicable-me.png" alt="Image5"></div>
</div>
Snippet 2: Desired Result
body{
background-color: #DD3735;
padding-top:30px;
}
.slider-wrap{
width:616px;
height:120px;
border:1px solid #ccc;
margin:0 auto;
box-shadow: 0 0 10px #000;
border-radius:5px;
}
img, .slider-boxes{
width:120px;
height:120px;
}
.slider-boxes{
display: inline-block;
-webkit-transition: all .2s ease-in-out;
transition: all .2s ease-in-out;
}
.slider-boxes:hover{
-webkit-transform: scale(1.30);
transform: scale(1.30);
box-shadow: 0 0 10px #000;
}
<div class="slider-wrap">
<div class="slider-boxes"><img src="https://pbs.twimg.com/profile_images/378800000108340114/a586d7a8df39836a114651aef74cd2d0_400x400.jpeg" alt="Image1"></div>
<div class="slider-boxes"><img src="https://s-media-cache-ak0.pinimg.com/736x/77/06/4e/77064e4e9ccc289ee5394dd7dbf48011.jpg" alt="Image2"></div>
<div class="slider-boxes"><img src="http://gloimg.gearbest.com/gb/2014/201411/goods-img/1415993980392-P-2179386.jpg" alt="Image3"></div>
<div class="slider-boxes"><img src="https://pbs.twimg.com/profile_images/378800000451012500/4628fbb9dc70514d389ed9491243866f_400x400.png" alt="Image4"></div>
<div class="slider-boxes"><img src="http://howtodrawdat.com/wp-content/uploads/2014/01/1st-pic-Dave-Minion-from-despicable-me.png" alt="Image5"></div>
</div>

This is not the prettiest solution, but it does solve it somewhat..
Adding a
.sliding-wrap:hover
{
overflow: visible;
}
does the trick, but it doesn't make the easing out very pretty..
Fiddle

Related

how to put html object element inside div

the html object is floating above the redbox div. How can i keep it inside the redbox div. I tried several options like reverse the divs. Somehow object is acting diverend then for example img tags. I don't know why, Search on the internet and didn't found a solution. I hope someone can help me and explain me what i'm doing wrong.
.redbox{
background-color: red;
border: 1px solid #ddd;
border-radius: 4px;
display: block;
line-height: 1.42857;
margin-bottom: 20px;
padding: 4px;
transition: border 0.2s ease-in-out 0s;
width:25%;
height: 200px;
}
.redbox object {
position:absolute;
top:0;
left:0;
width:100%;
height:25%;
}
.redbox .caption {
color: #333;
padding: 9px;
}
<html>
<head>
</head>
<body>
<div class="redbox">
<object data="https://mozilla.github.io/pdf.js/web/viewer.html" type="application/pdf"></object>
<div class ="caption">
here is some text
</div>
</div>
</body>
I think you can use Z-Index Property.
Here i am providing modified code please check it once.
.redbox{
background-color: red;
border: 1px solid #ddd;
border-radius: 4px;
display: block;
line-height: 1.42857;
margin-bottom: 20px;
padding: 4px;
transition: border 0.2s ease-in-out 0s;
width:25%;
height: 200px;
z-index : 1;
}
.redbox object {
position:absolute;
top:0;
left:0;
width:100%;
height:25%;
z-index:-1;
}
.redbox .caption {
color: #333;
padding: 9px;
}
<html>
<head>
</head>
<body>
<div class="redbox">
<object data="https://mozilla.github.io/pdf.js/web/viewer.html" type="application/pdf"></object>
<div class ="caption">
here is some text
</div>
</div>
</body>
</html>

(HTML: data-filter attribute) How to set default attribute section instead of showing all record.on page load

I need that default filter value should be set, instead of showing all elements.
Once Page is loaded, By default all values are getting displayed and on click of anchor specific filter values are getting displayed (like blue color in this example).
For Given Example:
After page load, instead of showing all color, Blue color elements needs to be shown. By default all values are getting displayed, but I need a specific color data value.
CSS:
section {
display: block;
float: left;
border: 2px solid green;
min-height: 300px;
width: 100%;
border-radius: 4px;
}
a {
display: block;
float: left;
width: 25%;
text-decoration: none;
text-align: center;
padding: 5px 0;
color: white;
background: #1271C7;
}
div {
display: block;
float: left;
height: 40px;
width: 40px;
border: 1px solid black;
margin: 10px;
-webkit-transition: all .8s linear;
-moz-transition: all .8s linear;
-o-transition: all .8s linear;
-ms-transition: all .8s linear;
transition: all .8s linear;
margin-top: 20px;
}
div[data-filter="red"] {
background: red;
}
div[data-filter="green"] {
background: green;
}
div[data-filter="blue"] {
background: blue;
}
a:focus[data-filter] {
opacity: .8;
outline: none;
}
a[data-filter="red"]:focus ~ div:not([data-filter="red"]) {
height: 0px;
width: 0px;
border: none;
margin: 0;
}
a[data-filter="green"]:focus ~ div:not([data-filter="green"]) {
height: 0px;
width: 0px;
border: none;
margin: 0;
}
a[data-filter="blue"]:focus ~ div:not([data-filter="blue"]) {
height: 0px;
width: 0px;
border: none;
margin: 0;
}
HTML:
<section>
<a id="tab2" href="#" data-filter="red" tabindex="-1">RED</a>
<a id="tab3" href="#" data-filter="green" tabindex="-1">GREEN</a>
<a id="tab4" href="#" data-filter="blue" tabindex="-1">BLUE</a>
<div data-filter="red"/>
<div data-filter="blue"/>
<div data-filter="red"/>
<div data-filter="blue"/>
<div data-filter="green"/>
<div data-filter="red"/>
<div data-filter="red"/>
<div data-filter="red"/>
<div data-filter="blue"/>
<div data-filter="green"/>
<div data-filter="blue"/>
<div data-filter="green"/>
<div data-filter="green"/>
</section>
You can use jQuery to customize your app. Using css alone you can't do this. here is the solution using jquery.
$(document).ready(function(){
$('div[data-filter="red"').show(0); // only red column on page load
$("a").click(function(e){
e.preventDefault();
var x=$(this).attr("data-filter"); //returns data-filter value of a tag
if(x=="all"){
$('div[data-filter').show(0);
}
else{
$("div[ data-filter]").hide(0);
$('div[data-filter="' + x +'"]').show(0);
}
})
})

Text not disappearing properly

CSS
#articlebottom {
width: 980px;
height: 250px;
}
.products{
width:980px;
margin:0px auto;
padding-left:20px;
}
#articlebottom .imgWrap {
width:295px;
height:200px;
position:relative;
float:left;
margin:10px;
background:#333;
}
#articlebottom .imgWrap img {
position:absolute;
left:5px;
top:5px;
width:285px;
height:190px;
}
#articlebottom .imgDescription1 {
position: absolute;
left:0;
letter-spacing: 2px;
background-color: rgba(255, 250, 250, 0.2);
color: rgba(255, 250, 250, 0.2);
font-weight:bold;
font-size:18pt;
line-height: 50px;
width:100%;
height:50px;
opacity: 0;
text-align:center;
text-transform:uppercase;
transition:opacity 500ms ease-in-out, color 20ms ease-in-out,height 500ms ease-in-out;
}
#articlebottom .imgWrap:hover .imgDescription1 {
opacity: 1;
height:200px;
line-height:200px;
color: #1b9bff;
}
HTML
<article id="articlebottom">
<div class="products">
<div class="imgWrap">
<a href="Products/Camphor.aspx" target="_blank"><img src="Images/Camphor_b.JPG" alt="polaroid" />
<p class="imgDescription1">Camphor</p></a>
</div>
</div>
</article>
Fiddle
What I'm having:
The Text appears on the center when i hover and going to top after hover
What i need:
When i hover on the image the appropriate text shoould appear on the center and also need to disappear on center of the image itself
Updated Fiddle
The crucial part is moving
height:200px;
line-height:200px;
color: #1b9bff;
From:
#articlebottom .imgWrap:hover .imgDescription1
To:
#articlebottom .imgDescription1
Otherwise the position of the text is set to a default/inherited value and only set to centred on hover, hence why the hover state sees it jump.

Position an object relative to its container?

I'm making a server listing website and for each server I'd like to display an image and some information that will be shown when the pictured is "hovered" with the mouse.
When the server name is too long, I want it to scroll to show the remaining text when hovered, how would I do this without specifying the length in CSS?
Example: http://jsfiddle.net/5EhSx/2
<div class='server'>
<div class='server_info'>
<div align='center' style='margin: 5px; white-space:nowrap; overflow:hidden;'><span class='server_name'>Abc def ghi jkl mno pqr stu vwx yza bcd efg hij klm nop qrs tuv wxy zab cde</span>
</div>
<div style='overflow:hidden; padding: 0 5px;'>
<div style='float:left;'>26 Comments</div>
<div style='float:right;'>17649 Votes</div>
</div>
<div style='overflow:hidden; padding: 0 5px;'>
<div style='float:left;'>Uptime: 99.7%</div>
<div style='float:right;'>73/96 Players</div>
</div>
</div>
</div>
Css:
.server {
font-family:Verdana, Geneva, sans-serif;
font-size:12px;
height: 170px;
width: 310px;
border: 1px solid grey;
position:relative;
overflow:hidden;
border-bottom-right-radius:7px;
border-bottom-left-radius:7px;
cursor:pointer;
float:left;
border-radius: 7px;
}
.server_info {
color: #FFFFFF;
background-color: rgba(0, 0, 0, 0.5);
position: absolute;
width: 100%;
bottom: 0;
border-bottom-right-radius:7px;
border-bottom-left-radius:7px;
height: 25px;
transition: height 0.5s;
-webkit-transition: height 0.5s;
}
.server_name {
position: relative;
left: 0;
transition: left 1s;
-webkit-transition: left 1s;
}
.server:hover .server_info {
height: 60px;
transition: height 0.5s;
-webkit-transition: height 0.5s;
}
.server:hover .server_name {
left: -165px;
transition: left 3s;
-webkit-transition: left 3s;
}
You can specify both properties: width and left (if position:absolute) or margin-left (if position:relative) in percentage, like: width:20%; margin-left:15%;

How to realize a fixed-width div with scrolling content on hover?

I am trying to create a div containing 2 divs: one for a cover img and the other div with some text.
I would love to show only the image and move it away on hover to show the text.
I wrote this code using absolute positioning and css transitions but there's something wrong.
It works great in Chrome but it doesn't in Firefox.
http://jsfiddle.net/5NHh2/4/
Could someone help me?
I think the problem is the overflow:hidden set to the main div.
Thank you very much
This is the html code:
<div class="container">
<div class="info-box">
<a href="#" title="">
<div class="cover">
<img src="http://placehold.it/180x267" />
</div>
<div class="info">
<h5>A Title</h5>
<p>Some text</p>
</div>
</a>
</div>
<div>​
And this is the css:
.container {
background:#000;
text-align:center;
padding:10px;
}
.info-box{
text-align:left;
overflow:hidden;
position:relative;
background:#ddd;
display:inline-table;
margin:0 10px 10px;
}
.info-box,
.info-box img,
.info-box .cover {
width:180px;
height:267px;
}
.info-box a {
text-decoration:none;
color:#333;
display:block;
position:absolute;
top:0;
left:0;
width:180px;
height:534px;
-webkit-transition: all 0.3s ease-out;
-moz-transition: all 0.3s ease-out;
-o-transition: all 0.3s ease-out;
transition: all 0.3s ease-out;
}
.info-box .info {
box-shadow:inset 0 0 2px #000;
}
.info-box a:hover{
top:-267px;
}
.info-box .info {
width:160px;
height:247px;
padding:10px;
position:relative;
}
.info {
text-shadow:0 1px 0 #fff;
}
.info-box .info h5 {
font-family:'Trebuchet MS',Arial,sans-serif;
overflow:hidden;
white-space:nowrap;
text-overflow:ellipsis;
margin-bottom:10px;
}
Added .container, .info-box {overflow:hidden;} to the end.
Works in firefox for me here: http://jsfiddle.net/5NHh2/5/