jQuery animate image swap -
i'm looking have image swap inside image gallery in way when user hovers on image grows in size , swaps out image. @ moment working soft fadein , fadeout effect. how can change faster transition , image looks growing in size?
html
<li class="carousel-img" data-alt-src="<?php the_sub_field('carousel_image_hover');?>" style="background-image:url( <?php the_sub_field('carousel_image');?> )" >
jquery
jquery(document).ready(function(e) { var bkgd_bl = ""; jquery('#carousel li').hover(function() { var bkgd = "url('" + jquery(this).attr('data-alt-src') + "')"; bkgd_bl = jquery(this).css('background-image'); jquery(this).stop().fadeout("1000", function() { jquery(this).css({ "background-image": bkgd, "height": 223, "width": 449 }).fadein(1000); //alert(bkgd_bl); }); }, function() { jquery(this).stop().fadeout("1000", function() { jquery(this).css({ "background-image": bkgd_bl, "height": 172, "width": 265 }).fadein(1000); }); }); });
maybe change
fadein(1000);
to faster? 300? if that's waht want.. show fiddle.
at bottom of http://iab.org.pl/ you`ll se logotypes, effect wanna achieve?
Comments
Post a Comment