Показать сообщение отдельно
  #11 (permalink)  
Старый 04.03.2018, 13:58
Аватар для рони
Профессор
Отправить личное сообщение для рони Посмотреть профиль Найти все сообщения от рони
 
Регистрация: 27.05.2010
Сообщений: 33,068

Dan_net,
<!DOCTYPE html>

<html>
<head>
  <title>Untitled</title>
  <meta charset="utf-8">
  <style type="text/css">
  .changeColor {fill:none;stroke:#FFFF00;stroke-width:5;stroke-miterlimit:10;}
  .st1 {fill:none;stroke:#ccccc;stroke-width:5;stroke-miterlimit:10;}
</style>

  <script src="https://ajax.googleapis.com/ajax/libs/jquery/1.12.4/jquery.min.js"></script>

  <script>
$(window).on("load", function() {
  var svgobject = document.getElementById("imap");
  var colorBg = "red blue green";
  var line = svgobject.querySelector(".changeColor");
  $.each(colorBg.split(" "), function(indx, bg) {
    $("<button>", {text:bg, click:function() {
      line.style.stroke = bg;
    }}).appendTo("#changeColor");
  });
});
  </script>
</head>

<body>
<div id="changeColor"></div>

<svg id="imap" version="1.1" xmlns="http://www.w3.org/2000/svg" x="0" y="0" viewBox="0 0 500 500" xml:space="preserve"><metadata><x:xmpmeta xmlns:x="adobe:ns:meta/" x:xmptk="Adobe XMP Core 5.6-c067 79.157747, 2015/03/30-23:40:42        "><rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"><rdf:Description rdf:about=""/></rdf:RDF></x:xmpmeta></metadata>

<polyline class="changeColor " points="132 47.5 365 47.5 481.5 249 365.1 450.5 132 450.5 15.7 249 107.9 89.5 338 89.5 429.4 248 338.1 406.5 155 406.5 64.2 248 133.6 127.5 319 127.5 388.2 249 318.5 370.5 179 370.5 109.3 249 160.1 160.5 300 160.5 350.8 249 299.8 337.5 198 337.5 146.8 249 181.5 188.7 282 188.1 "/>
<polyline class="st1" points="132 47.5 365 47.5 481.5 249 365.1 450.5 132 450.5 15.7 249 107.9 89.5 338 89.5 429.4 248 338.1 406.5 155 406.5 64.2 248 133.6 127.5 319 127.5 388.2 249 318.5 370.5 179 370.5 109.3 249 160.1 160.5 300 160.5 350.8 249 299.8 337.5 198 337.5 146.8 249 181.5 188.7 282 188.1 "/></svg>

</body>
</html>
Ответить с цитированием