所以我有一个SVG文件。如果你去网站,它应该动画,但它不会。它在localhost中工作。有人可以帮我吗?我认为已经有了一些帖子,但没有人回答,所以我虽然会做出新的:)。SVG和JavaScript - 动画SVG文件对象不起作用?
SVG文件:http://pastebin.com/raw/qn5gsTjV
JavaScript进行动感单车:
var wheelSVG = $();
var spinner = $();
$("object").load(function() {
wheelSVG = $("object").contents().find("svg");
spinner = spinner.add(wheelSVG.find("#spin"));
center = wheelSVG.find("#ui ellipse");
centerText = wheelSVG.find("#number");
clearInterval(beforeLoginSpinInterval);
if (!loggedinn) {
beforeLoginSpinInterval = setInterval(function() {
currentRotation += 0.25;
spinner.css("transform", 'rotate(' + currentRotation + 'deg)');
}, 20);
}
});
setTimeout(function() {
wheelSVG = $("object").contents().find("svg");
spinner = spinner.add(wheelSVG.find("#spin"));
center = wheelSVG.find("#ui ellipse");
centerText = wheelSVG.find("#number");
clearInterval(beforeLoginSpinInterval);
if (!loggedinn) {
beforeLoginSpinInterval = setInterval(function() {
currentRotation += 0.25;
spinner.css("transform", 'rotate(' + currentRotation + 'deg)');
}, 10);
}
请创建一个[MCVE](http://stackoverflow.com/help/mcve),这样我们就可以看到发生了什么,而无需执行大量工作。 –