Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/jquery/74.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 我可以在HTML5画布中创建图形形状对象吗?当用户将鼠标移到形状上时,如何将光标显示为指针_Javascript_Jquery_Css_Html_Html5 Canvas - Fatal编程技术网

Javascript 我可以在HTML5画布中创建图形形状对象吗?当用户将鼠标移到形状上时,如何将光标显示为指针

Javascript 我可以在HTML5画布中创建图形形状对象吗?当用户将鼠标移到形状上时,如何将光标显示为指针,javascript,jquery,css,html,html5-canvas,Javascript,Jquery,Css,Html,Html5 Canvas,实际上,我想创建一个时间轴,其中有一列用户可以滚动检查的部分,这些部分被表示为一列矩形,每个这样的部分都需要与事件有一个连接,再次像垂直连接到PTIPS循环一样重新表示 在这里,我想将这些部分和事件作为图形对象,这样我就可以向用户显示关于各自事件信息的pop 有没有办法在javascript中创建其对象的图形形状。 另外,当用户移动到该形状上时,我没有找到将光标显示为指针的方法。您可以使用jquery插件生成并显示一个指针。 这可能会使您的工作更快。您可以使用jquery插件生成并显示一个新的。

实际上,我想创建一个时间轴,其中有一列用户可以滚动检查的部分,这些部分被表示为一列矩形,每个这样的部分都需要与事件有一个连接,再次像垂直连接到PTIPS循环一样重新表示

在这里,我想将这些部分和事件作为图形对象,这样我就可以向用户显示关于各自事件信息的pop

有没有办法在javascript中创建其对象的图形形状。
另外,当用户移动到该形状上时,我没有找到将光标显示为指针的方法。

您可以使用jquery插件生成并显示一个指针。
这可能会使您的工作更快。

您可以使用jquery插件生成并显示一个新的。
这可能会使您的工作更快。

尝试使用html5 svg制作的圆圈代码

<!DOCTYPE html>
<html>
<body>
<div style="margin-left:100px;">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<circle cx="400" cy="400" r="200" stroke="black" class='yellow_cir' stroke-width="2" fill="red" />
<circle cx="400" cy="400" r="150" stroke="black" class='yellow_cir' stroke-width="2" fill="yellow" />
<circle cx="400" cy="400" r="100" stroke="black" class='yellow_cir' stroke-width="2" fill="cyan" />
<circle cx="400" cy="400" r="50" stroke="black" class='yellow_cir' stroke-width="2" fill="cyan" />
  <defs>
     <radialGradient id="grad1" cx="50%" cy="50%" r="50%" fx="50%" fy="50%">
      <stop offset="0%" style="stop-color:rgb(255,255,255);
      stop-opacity:1" />
      <stop offset="100%" style="stop-color:rgb(100,100,105);stop-opacity:1" />
    </radialGradient>

     <radialGradient id="grad2" cx="50%" cy="50%" r="50%" fx="50%" fy="50%">
      <stop offset="0%" style="stop-color:rgb(255,255,255);
      stop-opacity:1" />
      <stop offset="100%" style="stop-color:rgb(10,10,105);stop-opacity:1" />
    </radialGradient>
  </defs>
</svg> 



</div>
</body>
</html> 
<style type="text/css">


.yellow_cir:hover{ fill:url("#grad2");cursor:pointer;
}
.yellow_cir
{
    fill:url("#grad1");
}
</style>

.yellow_cir:hover{fill:url(#grad2”);cursor:pointer;
}
黄先生
{
填充:url(“#grad1”);
}

尝试使用html5 svg制作的圆圈代码

<!DOCTYPE html>
<html>
<body>
<div style="margin-left:100px;">
<svg xmlns="http://www.w3.org/2000/svg" version="1.1">
<circle cx="400" cy="400" r="200" stroke="black" class='yellow_cir' stroke-width="2" fill="red" />
<circle cx="400" cy="400" r="150" stroke="black" class='yellow_cir' stroke-width="2" fill="yellow" />
<circle cx="400" cy="400" r="100" stroke="black" class='yellow_cir' stroke-width="2" fill="cyan" />
<circle cx="400" cy="400" r="50" stroke="black" class='yellow_cir' stroke-width="2" fill="cyan" />
  <defs>
     <radialGradient id="grad1" cx="50%" cy="50%" r="50%" fx="50%" fy="50%">
      <stop offset="0%" style="stop-color:rgb(255,255,255);
      stop-opacity:1" />
      <stop offset="100%" style="stop-color:rgb(100,100,105);stop-opacity:1" />
    </radialGradient>

     <radialGradient id="grad2" cx="50%" cy="50%" r="50%" fx="50%" fy="50%">
      <stop offset="0%" style="stop-color:rgb(255,255,255);
      stop-opacity:1" />
      <stop offset="100%" style="stop-color:rgb(10,10,105);stop-opacity:1" />
    </radialGradient>
  </defs>
</svg> 



</div>
</body>
</html> 
<style type="text/css">


.yellow_cir:hover{ fill:url("#grad2");cursor:pointer;
}
.yellow_cir
{
    fill:url("#grad1");
}
</style>

.yellow_cir:hover{fill:url(#grad2”);cursor:pointer;
}
黄先生
{
填充:url(“#grad1”);
}

通过这一点,我揭示了我们可以使用svg而不是画布,但我们如何实现到svg上下文的滚动是我们需要看到时间线超过svg区域的可怕水平大小。我揭示了我们可以使用svg而不是画布,但我们如何实现到svg上下文的滚动是我们需要看到时间线超出svg区域的水平大小