jquery - Bounce effect to sprite icon using easing1.3.js -


i try apply bounce vertical effect social nav icon using jquery easing i'm not familiar js , need help.

html

<ul class="social">     <li class="facebook"><a class="bounce" href="http://facebook.com"></a></li>     <li class="twitter"><a class="bounce" href="http://twitter.com"></a></li> </ul> 

css

ul.social li {   float: left;   height: 28px;   width: 30px;           display: inline-block;    background: url("http://s14.postimg.org/ufud6x5n1/social.png") no-repeat; } ul.social li.facebook {   background-position: 0 0; } ul.social li.twitter {   background-position: -30px 0; } ul.social li.facebook a:hover {   background-position: 0 -28px; } ul.social li.twitter a:hover {   background-position: -30px -28px; } 

and here problem.

js

$(document).ready(function() {   $('.bounce').hover( function() {     $(this).animation(1000, "easeoutbounce");   }); }); 

how can make background bouncing on mouse hover , apply "normal" ease effect on mouse out?

i made codepen here

any appreciate :) (...and sorry not english)

this works except in firefox. still investigating...

 $(".bounce").mouseover(function(){     $(this).stop().animate({'background-position-y':'-28px'},{queue:false, duration:600, easing: 'easeoutbounce'}) }); $(".bounce").mouseout(function(){     $(this).stop().animate({'background-position-y':'0'},{queue:false, duration:800, easing: 'linear'}) }); 

edit: ok, found answer:
1. using jquery background position animation plugin (found answer here)
2. , works firefox

$(".bounce-fb").mouseover(function(){     $(this).stop().animate({'backgroundposition':'0 -28px'},{queue:false, duration:600, easing: 'easeoutbounce'}) }); $(".bounce-fb").mouseout(function(){     $(this).stop().animate({'backgroundposition':'0 0'},{queue:false, duration:800, easing: 'linear'}) });  $(".bounce-tw").mouseover(function(){     $(this).stop().animate({'backgroundposition':'-30px -28px'},{queue:false, duration:600, easing: 'easeoutbounce'}) }); $(".bounce-tw").mouseout(function(){     $(this).stop().animate({'backgroundposition':'-30px 0'},{queue:false, duration:800, easing: 'linear'}) }); 

everything working wanted now. see demo


Comments

Popular posts from this blog

php - failed to open stream: HTTP request failed! HTTP/1.0 400 Bad Request -

java - How to filter a backspace keyboard input -

java - Show Soft Keyboard when EditText Appears -