私はグリッドを持っています。マウスが特定の画像の上にくると、その画像のより大きなバージョンが、オリジナルのグリッド画像に若干大きなバージョンで来るオーバーレイになります。mouseoverとmouseoutに関する問題
マウスオーバーがうまく機能します。 mouseoutとmouseleaveの両方により、大きな画像が即座にフェードアウトします。マウスが終了したかどうか。
function imageSize(img){
var theImage = new Image();
$(theImage).load(function() {
var imgwidth = this.width;
var imgheight = this.height;
var position = img.parent().position()
var index = img.parent().index();
///calculate top
var top = (position.top -((imgheight-img.height())/2));
var left = (position.left -((imgwidth-img.width())/2));
/// place image in img_pop
var clone;
clone = '<div class="pop_img clone'+index+'"></div>';
$(clone).insertAfter($('BODY'));
$('.pop_img.clone'+index+'').css({
'width' : img.width(),
'height' : img.height(),
'top' : position.top,
'left' : position.left,
'backgroundImage' : 'url('+theImage.src+')',
});
$('.pop_img.clone'+index+'').stop().animate({
'height' : imgheight,
'top' : top,
'width' : imgwidth,
'left' : left,
},300,'easeInOutQuad');
});
theImage.src = img.attr('src');
}
$('.am-wrapper img').live('mouseenter',function(){
imageSize($(this));
});
$('.am-wrapper img').live('mouseleave',function(){
thisIndex = $(this).parent().index();
$('.pop_img.clone'+thisIndex+'').fadeOut('200');
});
私は、理想的には、マウスがそれぞれのグリッド像の上にある間にオーバーレイ画像が見えると場所に滞在したいです。ユーザーが別のグリッドイメージのマウスを置くと、古いオーバーレイがフェードアウトします。
ええ、私はオーバーレイがかもしれないと考えました。私はあなたが正しいと思います、ある種のパラメータ検出が必要です。 : –
おかげさまで、これは大きな助けとなり、他のヒントのおかげです。 –
@ChrisSamson:Eureka!これまでにやったことを思い出しました。私の編集を参照してください。 –