troubleshooting Question

Jquery load problem, unable to trigger a function on page load

Avatar of 51501984
51501984Flag for United Kingdom of Great Britain and Northern Ireland asked on
JavaScript
5 Comments1 Solution2209 ViewsLast Modified:
I'm using someone's Jquery code to make a page element pulse. the code works absolutely fine if I want the element to pulse when it is clicked upon but I cannot figure out how to trigger the function when the page loads (i.e. it just starts pulsing you don't have to click on it)

I'm sure it's very straight forward, but I'm new to Jquery and I can't figure it out; I thought replacing click with load would do it but alas no.

The original demo is here:

http://ui.jquery.com/repository/real-world/effects/


$(document).ready(function() {
	
	$("div.effect")
		.hover(function() {
			$(this).addClass("hover");
		}, function() {
			$(this).removeClass("hover");
		})
		;
	
	
	var effect = function(el, n, o) {
		
		$.extend(o, {
			easing: "easeOutQuint"
		});
		
		$(el).bind("click", function() {
			
			$(this).addClass("current").hide(n, o, 1500, function() {
				var self = this;
				window.setTimeout(function() {
					$(self).show(n, o, 1500, function() { $(this).removeClass("current"); });
				},500);
			});
		});
		
	};
	
 
 
	
	effect("#pulsate", "pulsate", { times: 4 });
 
	
	$("#transfer").bind("click", function() { $(this).addClass("current").effect("transfer", { to: "div:eq(0)" }, 1000, function() { $(this).removeClass("current"); }); });
	
});
 
 
on the page:
 
		<div class="effect" id="pulsate">
		<p>Pulsate 2 times</p>
		</div>
 
like i say it works when it's clicked on but I would like to work automatically when the page loads.
ASKER CERTIFIED SOLUTION
51501984

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros