チェックアウトhttp://social.allthingswebdesign.com。 「ソーシャルになる」リンクをクリックすると、そのリンクが飛び出し、マウスを動かすと、それが開始された場所に戻ります。シンプルなjQueryの質問
「Get Social」リンクをクリックすると、「Social」リンクをクリックして「X」をクリックして閉じると、遠すぎてから飛び出します。
これをチェックすると、私の言いたいことがわかります。これは非常に単純なもののようですが、私は真剣な脳のおならを持っており、それを理解することはできません。
$(document).ready(function() {
$('body').prepend('<div id="social"><div id="outer"><span><img src="getSocial.png" alt="Get Social" />' +
'<ul id="icons"><li><img class="tiny" src="fb.png" alt="Facebook" /></li><li><img class="tiny" src="twit.png" alt="Twitter" /></li></ul>' +
'</span></div><div id="inner"><div id="innest"><ul><li>'+
'<img src="fb.png" alt="Facebook" /><a href="#">Find Us On Facebook</a>'+
'</li><li>'+
'<img src="twit.png" alt="Twitter" /><a href="#">Follow Us On Twitter</a>'+
'</li></ul><div id="close"><a id="closeB" href="#">X</a></div></div></div></div>');
$('#social').live('hover', function() {
var $lefty = $(this);
$lefty.stop().animate({
marginLeft: parseInt($lefty.css('marginLeft')) == -302 ?
-295 : -302
}, 200);
});
$('#social').live('click', function() {
var $lefty = $(this);
$lefty.stop().animate({
marginLeft: parseInt($lefty.css('marginLeft')) == 0 ?
(40 - $lefty.outerWidth()) : 0
}, 200);
});
$('#closeB').live('click', function() {
var $button = $(this).parent('#social');
$button.stop().animate({
marginLeft: parseInt($button.css('marginLeft')) == 0 ?
-302 : 0
}, 200);
});
});
参考までに、Chromeでは私のためにしか起こっていないようです(Firefoxで動作します) –
FFで動作しません。 – Catfish