我已经插入了一些javascript代码,我知道它不完整。我只是想知道把它放在哪里以使它变得活跃。这是我在弗吉尼亚州的一个县的svg,我试图让它淡入和淡出页面。这个网站要求我提供更多信息,但我觉得我已尽我所能。此外,这是我拥有的完整代码,没有更多。
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!-- Created with Inkscape (http://www.inkscape.org/) -->
<svg
xmlns:dc="http://purl.org/dc/elements/1.1/"
xmlns:cc="http://creativecommons.org/ns#"
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
xmlns:svg="http://www.w3.org/2000/svg"
xmlns="http://www.w3.org/2000/svg"
xmlns:sodipodi="http://sodipodi.sourceforge.net/DTD/sodipodi-0.dtd"
xmlns:inkscape="http://www.inkscape.org/namespaces/inkscape"
version="1.0"
width="84.470001"
height="48.330002"
sodipodi:version="0.32"
inkscape:version="0.48.2 r9819"
sodipodi:docname="va.svg"
inkscape:output_extension="org.inkscape.output.svg.inkscape"
id="svg3127"
transform="translate(200,-100) rotate(10)"
>
**<script type="text/javascript">
$(function() {
$("#visible".click(function() {
$('#invisible').toggleClass("show");
});
});
</script>
<style>
.hide{display:none;}
.show{display:block;}
</style>**
<metadata
id="metadata3129">
<rdf:RDF>
<cc:Work
rdf:about="">
<dc:format>image/svg+xml</dc:format>
<dc:type
rdf:resource="http://purl.org/dc/dcmitype/StillImage" />
</cc:Work>
</rdf:RDF>
</metadata>
<defs
id="defs3131" />
<sodipodi:namedview
fill="#A9A9A9"
pagecolor="#ffffff"
bordercolor="#666666"
borderopacity="1"
objecttolerance="10"
gridtolerance="10"
guidetolerance="10"
inkscape:pageopacity="0"
inkscape:pageshadow="2"
inkscape:window-width="1366"
inkscape:window-height="716"
fit-margin-top="0"
fit-margin-left="0"
fit-margin-right="0"
fit-margin-bottom="0"
inkscape:zoom="6.4335112"
inkscape:cx="38.957601"
inkscape:cy="17.76589"
inkscape:window-x="-8"
inkscape:window-y="-8"
inkscape:window-maximized="1"
inkscape:current-layer="svg3127"
id="namedview3133"
showgrid="false" />
<path
style="font-size:12px;fill:#d0d0d0;fill-opacity:1;fill-
rule:nonzero;stroke:#000000;stroke-width:1;stroke-linecap:butt;stroke-
linejoin:bevel;stroke-miterlimit:4;stroke-opacity:1;stroke-
dasharray:none;marker-start:none"
d="m 78.821553,15.007566 3.672,-1.249 -0.347,0.984 -0.789,1.297
-0.279,0.055 -0.082,0.058 -0.026,0.032 -0.032,0.035 -0.063,0.077 -0.04,0.064
-0.041,0.063 -0.037,0.058 -0.139,0.289 -0.18,0.476 -0.298,1.362 -0.035,0.248
-0.258,2.872 0.041,0.112 -0.514,0.23 -0.883,0.068 -0.068,-0.046
-0.041,-0.095 0.014,-0.031 0.059,-0.041 0.081,-0.135 -0.053,-0.523
-0.569,-0.23 -0.975,0.29 -0.058,-0.109 -0.012,-0.068 0.062,-0.495
0.091,-0.321 0.672,-2.001 0.468,-0.689 0.162,-0.217 0.047,-0.094
0.17,-0.506 0.008,-0.157 -0.058,-1.018 0.33,-0.645"
id="Accomack"
inkscape:connector-curvature="0" />
</svg>
答案 0 :(得分:0)
要回答您的具体问题:<script>
元素可以放在SVG的任何位置。你把它放在哪里并不重要。
你拥有它,应该工作。删除星号后,使用缺少的jQuery脚本解决问题。