0

I'm trying to fading effect in image gallery section. It's ok but if image height is higher span does not contain the all image. Here is the page link.

And, here is my jquery code for finding image size:

 // ON MOUSE OVER
$(".roll").hover(function () {

// SET OPACITY TO 70%
var  height=$('.img-galeri').height();
var  width =$('.img-galeri').width();
$(this).height(height);
$(this).width(width);
$(this).stop().animate({
opacity: .7
}, "slow");
},

thanks for help.

4

1 回答 1

2

当您获得通用的高度和宽度时,您只需要指定要覆盖的图像。

尝试将您的代码更改为:

// ON MOUSE OVER
$(".roll").hover(function () {

// SET OPACITY TO 70%
var  height=$(this).parent().children(".img-galeri").height();
var  width =$(this).parent().children(".img-galeri").width();
$(this).height(height);
$(this).width(width);
$(this).stop().animate({
opacity: .7
}, "slow");
},
于 2013-10-31T14:09:01.937 回答