Help converting simple jQuery wiggle to jQuery "Pulse" instead

Here is some code I used in the past for a site that works perfect as is for a wiggle. Wiggles object every 5 seconds - 3 times - and stops. This is exactly what I need now but with one minor change. Instead of wiggling an object I just need to increase text size. A brief pulse. Is that possible? Thanks!

/* jQuery Wiggle  
------------------------------------------------------*/
(function(a){a.fn.wiggle=function(d,c){c=a.extend({degrees:["2","4","2","0","-2","-4","-2","0"],delay:20,limit:null,randomStart:true,onWiggle:function(e){},onWiggleStart:function(e){},onWiggleStop:function(e){}},c);var b={wiggle:function(g,e){if(e===undefined){e=c.randomStart?Math.floor(Math.random()*c.degrees.length):0}if(!a(g).hasClass("wiggling")){a(g).addClass("wiggling")}var f=c.degrees[e];a(g).css({"-webkit-transform":"rotate("+f+"deg)","-moz-transform":"rotate("+f+"deg)","-o-transform":"rotate("+f+"deg)","-sand-transform":"rotate("+f+"deg)",transform:"rotate("+f+"deg)"});if(e==(c.degrees.length-1)){e=0;if(a(g).data("wiggles")===undefined){a(g).data("wiggles",1)}else{a(g).data("wiggles",a(g).data("wiggles")+1)}c.onWiggle(g)}if(c.limit&&a(g).data("wiggles")==c.limit){return b.stop(g)}g.timeout=setTimeout(function(){b.wiggle(g,e+1)},c.delay)},stop:function(e){a(e).data("wiggles",0);a(e).css({"-webkit-transform":"rotate(0deg)","-moz-transform":"rotate(0deg)","-o-transform":"rotate(0deg)","-sand-transform":"rotate(0deg)",transform:"rotate(0deg)"});if(a(e).hasClass("wiggling")){a(e).removeClass("wiggling")}clearTimeout(e.timeout);e.timeout=null;c.onWiggleStop(e)},isWiggling:function(e){return !e.timeout?false:true}};if(d=="isWiggling"&&this.length==1){return b.isWiggling(this[0])}this.each(function(){if((d=="start"||d===undefined)&&!this.timeout){b.wiggle(this);c.onWiggleStart(this)}else{if(d=="stop"){b.stop(this)}}});return this}})(jQuery);

/* Fire jQuery Wiggle - 1500 = how long each wiggle, 5000 = time between each wiggle, 21000 = total duration of wiggle */
function wiggleForOneSecond(a){a.wiggle();setTimeout(function(){a.wiggle("stop")},1500)}$(document).ready(function(){var b=$(".wiggle");var a=setInterval(function(){wiggleForOneSecond(b)},10000);setTimeout(function(){window.clearInterval(a)},31000);b.hover(function(){window.clearInterval(a)})});

I would imagine so.
These days you probably won’t need javascript, let alone jquery. It could be done with css animation.

2 Likes

This topic was automatically closed 91 days after the last reply. New replies are no longer allowed.