1

Epione blogger template のように、同じ jQuery ホバー効果 (イージング) を取得するにはどうすればよいですか?

私は自分のブログに載せるために非常に多くの方法を試しましたが、私は jQuery アニメーション コードの初心者だと思います。

これで私を助けていただければ、とても感謝しています。

HTML コード

<div id='get_social'>
<div class='get_social_wrap'>
    <a class='follow_fb_link' href='http://www.facebook.com/facebook-id' title='follow us on facebook'/>
    <a class='follow_twitter_link' href='http://twitter.com/twetter-id' title='follow us on twitter'/>
    <a class='follow_rss_link' href='/feeds/posts/default' title='subscribe to our rss feed'/>

 </a></a></a></div>

CSSコード

#get_social{float:left; position:relative; margin:0px;}
.get_social_wrap{ position:relative; width:160px; margin-top:15px;}

.follow_fb_link{width:22px; height:22px; background:url(http://1.bp.blogspot.com/-cKUUmDR1mkw/ThsIt1kAzlI/AAAAAAAABOQ/PFgbBB1e0VQ/s1600/ep_fb.png) no-repeat; float:left; margin-right:7px;}
.follow_twitter_link{width:22px; height:22px; background:url(http://3.bp.blogspot.com/-ne3mIs7NGqk/ThsIuqNTIjI/AAAAAAAABOg/kIbh7Z9A96E/s1600/ep_twitter.png) no-repeat;  margin-right:7px; float:left;}
.follow_rss_link{width:22px; height:22px; background:url(http://4.bp.blogspot.com/-V_MuLwEucB0/ThsIuOcu7OI/AAAAAAAABOY/4jyEVTewJQM/s1600/ep_feed.png) no-repeat; margin-right:7px; float:left;}

jQuery イージング プラグイン

<script src='http://my-subtitles-blog.googlecode.com/svn/trunk/jquery.easing.1.3.js' type='text/javascript'/>
4

3 に答える 3

2

彼らがしているのは、次のような写真を持っていることだけです。

フェイスブックのアイコン ツイッターのアイコン ここに画像の説明を入力

背景として、ホバー時に背景の位置をアニメーション化します。


彼らのサイトからの関連するコードは次のとおりです。

jQuery(function(){
    var easing = 'easeOutBounce';
    jQuery('.follow_fb_link, .follow_twitter_link, .follow_rss_link').css({backgroundPosition: '0px 0px'})
        .mouseover(function(){
            jQuery(this).stop().animate({backgroundPosition:'0 -22px'},200, easing)
        })
        .mouseout(function(){
            jQuery(this).stop().animate({backgroundPosition:'0 0'},200, easing)
        });
});
于 2011-09-13T03:28:17.650 に答える
1

彼がやっていることは、タグの背景位置をアニメーション化し、「弾性」を使用することです (私は思います)。したがって、次のようになります。

$('get_social_wrap a').hover(function(){
    $(this).stop().animate({
        backgroundPosition :  '50% 25px'
    }, 'easeInOutElastic');
}, function(){
    $(this).stop().animate({
        backgroundPosition :  '50% 0px'
    }, 'easeInOutElastic');
});

アニメーションの構文とイージングの詳細については、http://api.jquery.com/animate/ をご覧ください

于 2011-09-13T03:29:47.357 に答える
0

あなたの答えをありがとう、私は問題を見つけました。(jQuery Background Position Animation Plugin)を追加する必要があり、すべて正常に動作し、ここからダウンロードできます

http://keith-wood.name/backgroundPos.html

ここからイージングプラグイン

http://gsgd.co.uk/sandbox/jquery/easing/

最終的なコードは次のようになります。お楽しみください :)

<script src='/jquery.easing.1.3.js' type='text/javascript'/>
<script src='jquery.backgroundpos.js' type='text/javascript'/>
<script type='text/javascript'> 
$(function(){
var easing = &#39;easeOutBounce&#39;;
$(&#39;.follow_fb_link, .follow_twitter_link, .follow_rss_link&#39;).css({backgroundPosition: &#39;0px 0px&#39;})
    .mouseover(function(){
        $(this).stop().animate({backgroundPosition:&#39;0 -22px&#39;},200, easing)
    })
    .mouseout(function(){
        $(this).stop().animate({backgroundPosition:&#39;0 0&#39;},200, easing)
    });
});
</script>
于 2011-09-13T15:37:29.693 に答える