Javascript 桌面firefox中的偏移量值不同

Javascript 桌面firefox中的偏移量值不同,javascript,jquery,html,firefox,svg,Javascript,Jquery,Html,Firefox,Svg,请在链接中查看我的代码 代码: <body> <div id="content" style="width:400px; height:110px;"> <svg id="circle" height="300" width="300"> <circle cx="150" cy="150" r="40" stroke="black" stroke-width="3" fill="red" /> </s

请在链接中查看我的代码

代码:

<body>
  <div id="content" style="width:400px; height:110px;">
     <svg id="circle" height="300" width="300">
        <circle cx="150" cy="150" r="40" stroke="black" stroke-width="3" fill="red" />
      </svg>
    </div>
 <div>     
 <button onclick="myFunction()">Click me</button>

 function myFunction() {
        var a = $(document.getElementById("circle")).offset().top;
        alert(a);
    }
当我运行此程序时,我在所有浏览器(包括笔记本电脑和台式机)中都得到了0值,但最高值只能在firefoxin台式机中变化,而不能在笔记本电脑中变化。。。请给出一个更好的解决方案


如何解决这个问题?

使用下面的代码。查看演示


您好,这是确定的,请在destop firefox中检查相同的代码。值可以是不同的,这是我的issue@AkbarBasha我签入桌面上的所有浏览器。safari,firefox.chrome。返回相同的值。@AkbarBasha FF版本在MAC os上是36.0.1。很抱歉,我这里没有笔记本电脑:@AkbarBasha我也检查了你的小提琴。在我的FF上它给出了0:Firefox 30在不久前已经过时了。在fiddle中将jQuery版本更改为1.10.1,并检查@yasin checked,但这个问题仅在Firefox版本30以下的版本中重现
function myFunction() {
    var a = $("#circle").offset().top;
    alert(a);
}