我正在开发一个web应用程序,其中我必须显示温度、湿度、风速、风向等。我正在使用google.visualization.Gauge()来显示其他内容,但我想在指南针上显示风向。有没有人知道有什么(jQuery/javascript/etc)指南针可以用在网站/webapp上?谢谢
发布于 2012-07-18 00:11:44
这是我仅使用CSS的方法。使用变换来旋转针。你也可以使用jQuery Rotate插件。
HTML
<div id="compass">
<div id="arrow"></div>
</div>CSS
#compass {
width: 380px;
height: 380px;
background-image:url('http://i.imgur.com/44nyA.jpg');
position: relative;
}
#arrow {
width: 360px;
height: 20px;
background-color:#F00;
position: absolute;
top: 180px;
left: 10px;
-webkit-transform:rotate(120deg);
-moz-transform:rotate(120deg);
-o-transform:rotate(120deg);
-ms-transform:rotate(120deg);
-moz-transition: all 1s ease;
-webkit-transition: all 1s ease;
-o-transition: all 1s ease;
transition: all 1s ease;
}
#compass:hover #arrow {
-webkit-transform:rotate(0deg);
-moz-transform:rotate(0deg);
-o-transform:rotate(0deg);
-ms-transform:rotate(0deg);
}发布于 2012-07-18 00:02:25
HTML5和它的Canvas将很快完成这项工作。
http://www.tutorialspoint.com/html5/canvas_drawing_lines.htm
我把它贴在这里只是为了完整,就我个人而言,我仍然坚持使用javascript库。
https://stackoverflow.com/questions/11526277
复制相似问题