Hallo zusammen,
ich habe mir auf jsFiddle ein Bild mit Text-Overlay zusammengebastelt und es funktioniert zu 90% wunderbar.
ABER warum auch immer wird ein kleiner Rand nicht von der Overlay-Box überdeckt.
Hier der Link: http://jsfiddle.net/anLffygk/3/
![[Bild: 12191861_1685398451725343_37409831369078...e=56AE0EC3]](https://scontent-vie1-1.xx.fbcdn.net/hphotos-xtf1/v/t1.0-9/12191861_1685398451725343_3740983136907825207_n.jpg?oh=d5698f7df5d66b2c473206ed1c1045aa&oe=56AE0EC3)
Gruß
Max Spies
ich habe mir auf jsFiddle ein Bild mit Text-Overlay zusammengebastelt und es funktioniert zu 90% wunderbar.
ABER warum auch immer wird ein kleiner Rand nicht von der Overlay-Box überdeckt.
Hier der Link: http://jsfiddle.net/anLffygk/3/
![[Bild: 12191861_1685398451725343_37409831369078...e=56AE0EC3]](https://scontent-vie1-1.xx.fbcdn.net/hphotos-xtf1/v/t1.0-9/12191861_1685398451725343_3740983136907825207_n.jpg?oh=d5698f7df5d66b2c473206ed1c1045aa&oe=56AE0EC3)
Code:
<style>
.out {
width:30%;
margin:50px;
}
.texthover * {margin:0; padding:0;}
.texthover img {width:100%; height:auto;}
.texthover .content {
background:rgba(0,0,0,0.5);
color:#fff;
position:absolute;
opacity:0;
transition:0.2s opacity;
}
.texthover .content .inner{
padding:20px;
}
.texthover:hover .content{opacity:1}
</style>
<script src="jquery.js"></script>
<script>
function imagehover(){
$( ".texthover" ).each(function(i) {
var imgH = $(this).children('img').height();
var imgW = $(this).children('img').width();
$(this).children('.content').css('height', imgH);
$(this).children('.content').css('width', imgW);
$(this).children('.content').css('margin-top', -imgH-4);
});
}
$( window ).resize(function() {
imagehover();
});
imagehover();
</script>
<div class="out">
<div class="texthover">
<img src="http://img.pr0gramm.com/2015/10/31/c24dc3972ff123f8.jpg">
<div class="content">
<div class="inner"><p>Lorem ipsum dolor sit amet, consetetur sadipscing elitr, sed diam nonumy eirmod tempor invidunt ut labore et dolore magna aliquyam erat, sed diam voluptua. At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, no sea takimata sanctus est Lorem ipsum dolor sit amet.</p></div></div>
</div>
</div>
Max Spies