javascript - Fading in Class in SVG via jQueryUI -
i want group of elements (g) fade in clicking button, doesn't want work me. hope can help.
<!doctype html> <html lang="en"> <head> <title>test</title> <style> .container{ visibility: visible; height: 321px; width: 441px; margin-left: auto; margin-right: auto; margin-top: 200px; } g.p2{ visibility: visible; } g.cc{ visibility: visible; } </style> <script src="https://code.jquery.com/jquery-1.12.4.js"></script> <script src="https://code.jquery.com/ui/1.12.1/jquery-ui.js"></script> <script> $("#p1").click(function () { $(".p1").fadetoggle("slow","linear"); }) </script> </head> <body> <div class="container"> <svg xmlns="http://www.w3.org/2000/svg" xmlns:xlink="http://www.w3.org/1999/xlink" width="441px" height="321px" version="1.1"> <defs/> <g transform="translate(0.5,0.5)" style="color: #000000"> <g class="p1" style="visibility: visible"> <rect x="0" y="240" width="80" height="80" pointer-events="none"/> <g transform="translate(12.5,266.5)" style="color:#ffffff;"> <switch> <foreignobject style="overflow:visible;" pointer-events="all" width="54" height="26" requiredfeatures="http://www.w3.org/tr/svg11/feature#extensibility"> <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: helvetica; line-height: 1.2; vertical-align: top; width: 56px; white-space: nowrap; word-wrap: normal; text-align: center;"> <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; text-align:inherit;text-decoration:inherit;">text<br>block 1</div> </div> </foreignobject> <text x="27" y="19" text-anchor="middle" font-size="12px" font-family="helvetica">[not supported viewer]</text> </switch> </g> </g> <g class="p2"> <rect x="360" y="240" width="80" height="80" pointer-events="none"/> <g transform="translate(372.5,266.5)" style="color:#ffffff;"> <switch> <foreignobject style="overflow:visible;" pointer-events="all" width="54" height="26" requiredfeatures="http://www.w3.org/tr/svg11/feature#extensibility"> <div xmlns="http://www.w3.org/1999/xhtml" style="display: inline-block; font-size: 12px; font-family: helvetica; line-height: 1.2; vertical-align: top; width: 56px; white-space: nowrap; word-wrap: normal; text-align: center;"> <div xmlns="http://www.w3.org/1999/xhtml" style="display:inline-block;text-align:inherit;text-decoration:inherit;">text<br>block 2</div> </div> </foreignobject> <text x="27" y="19" text-anchor="middle" font-size="12px" font-family="helvetica">[not supported viewer]</text> </switch> </g> </g> <g class="cc"> <image x="59.5" y="-0.5" width="40" height="40" xlink:href="icons/cc.png" pointer-events="none"/> </g> </g> </svg> </div> <br> <br> <div style="text-align: center;"> <button id="p1">show provider1</button> </div> </body> </html>
in fact want appear , disappear if clicks button. doesn't want work ... couldn't find fault, fadetoggle
event should job think (http://api.jquery.com/fadetoggle/)
Comments
Post a Comment