html - custom jQuery function to crossfade fonts -


i need custom jquery function lets me target text elements class, class="fontfade", , cause elements crossfade original font new font. can change font this

$(".one").css("font-family", "comic sans ms"); 

and html code is

<p class="one">demonstrate transition.</p> 

the tricky thing here crossfading. want smooth transition previous font new font. mean text previous font fadeout , text new font fadein. @ point both text different font can seen.

i trying this

$(".one").fadeout(3000); $(".one").css("font-family", "comic sans ms"); $(".one").fadein(3000); 

not working..

<p><a href="#" class="one">demonstrate transition.</a></p>  <script>     $(document).on('click', '.one' ,function() {         $(".one").fadeout(3000);         $(".one").css("font-family", "comic sans ms");         $(".one").fadein(3000);     }); </script> 



edit: after re-reading post , comment, perhaps you're after?

<script>     .old {         font-family: helvetica;     }     .new {         font-family: comic sans;     }     .hide {         display: none;     } </script>   <p><a href="#" class="one">demonstrate transition.</a></p> <div class="old">old font</div> <div class="new hide">new font</div>  <script>     $(document).on('click', '.one' ,function() {         $('.old').fadeout(500);          $('.new').fadein(500, function(){             $(this).removeclass('hide').css("font-family", "comic sans ms");         });     }); </script> 

Comments

Popular posts from this blog

visual studio - vb.net filter binding source by time -

php - SPIP: From Tag directly to an article -

jquery - isAjaxRequest always return false -