私はこのアニメーションを持っています。ホバリングでは私のスパンのサイズが大きくなります。 しかし、マウスの中心から始まるアニメーションが好きです。ホバリングの中心からアニメーションのサイズを変更します
どうすればいいですか?
https://jsfiddle.net/telman/9rrbzwem/
$(document).mousemove(function(e){
$("span").css({left:e.pageX - 50, top:e.pageY - 50});
});
$("div").hover(
function() {
$(this).stop().animate({"opacity": "0.5"}, 0);
$("span").stop().animate({"height": "100px", "width": "100px"}, 200);
},
function() {
$(this).stop().animate({"opacity": "1"}, 0);
$("span").stop().animate({"height": "0px", "width": "0px"}, 200);
}
);
あなた 'div'は全くサイズを変更しません。あなたは赤い「スパン」を意味しますか? –
はいこれはスパンです – user3870112
[CSSを使用して上と左の代わりに中央からdivを展開]の可能な複製(http://stackoverflow.com/questions/8451909/expand-div-from-the-middle-instead-ちょうどトップ・アンド・レフト・ユースのCSS) – Roberrrt