Click here to Skip to main content
15,888,202 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi,

I`m trying to load an SVG animation inside a DIV tag using javascipt using onclick function,

Here is the code with the load function, how can I make the SVG load by clicking an html menu item on my page?

JavaScript
$(function(){

	$("#stage").load('interactive.svg',function(response){

		$(this).addClass("svgLoaded");
		
		if(!response){ // Error loading SVG
			$(this).html('Error loading SVG. Be sure you are running from a the http protocol (not locally) and have read <a href="http://tympanus.net/codrops/?p=13831#the-javascript">this important part of the tutorial</a>');
		}

	});
});
Posted
Updated 15-Oct-13 20:21pm
v3

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900