RT.
$("#divId").offset()
的返回值是{top:xxxxxx, left:XXX}$("#divId").offset().left
返回值也是个正数为什么$("#divId").offset().top
不能正常返回top值,而是返回了个window类型的值求大神解释~
$("#divId").offset()
的返回值是{top:xxxxxx, left:XXX}$("#divId").offset().left
返回值也是个正数为什么$("#divId").offset().top
不能正常返回top值,而是返回了个window类型的值求大神解释~
解决方案 »
- 通过Ajax的post方式,参数写在URL里,参数值最大长度是多少?请问如何通过Ajax方式将长文本向后传递?
- 执行改程序,子页面变动了,但网址没变动
- 关于jQuery bing与unbind的使用?
- jquery 中的simpleTree 请高手指教!!!!
- 请帮我看下这段JS特效哪是设置字体大小的
- Extjs中通过store传递数据
- 求个正则,在线等。解决马上给分
- 高手请帮忙呀!!!我用Javascript验证注册页面,可就是怎么已不能验证通过!!!小弟刚学!!!
- 求一个在窗口大小范围内漂浮的广告框,而且碰到窗口四周会反弹
- 请问如何把iframe嵌入文件的滚动栏去掉?谢谢!
- 急!jquery获取某行某列的问题
- js 时间戳转换为日期格式
<div>
<img id="imgLogo" style="position: fixed; top: 5%; left: 5%; border-bottom: 1px #ccc solid;"
src="Image/logo.png" />
</div>
<img id="imgArrow" style="position: fixed; filter:alpha(opacity=0); -moz-opacity: 0;
opacity: 0;" src="Image/arrow.png" />
</div>
</form>
<script type="text/javascript"> var top = $("#imgLogo").offset().top;
var left = $("#imgLogo").offset().left;
$("#imgArrow").css("top", top + 100);
$("#imgArrow").css("left", left + 100);
$("#imgArrow").animate({ opacity: '1' }, 4000, null); </script>
这里top取不到返回了一个window类型。。
<div style="background-color: #ffffff;">
<div>
<img id="imgLogo" style="position: fixed; top: 5%; left: 5%; border-bottom: 1px #ccc solid;"
src="Image/logo.png" alt="logo" />
</div>
<img id="imgArrow" style="position: fixed; filter:alpha(opacity=0); -moz-opacity: 0;
opacity: 0;" src="Image/arrow.png" />
</div>
<script type="text/javascript"> var top = $("#imgLogo").offset().top;
var left = $("#imgLogo").offset().left;
alert(top+'\n'+left)
$("#imgArrow").css("top", top + 100);
$("#imgArrow").css("left", left + 100); $("#imgArrow").animate({ opacity: '1' }, 4000, null); </script>没问题,不过起得变量名最好不要和系统的内置对象一样,top是顶层窗体变量名称,你的应该是冲突了获取到的是top窗体。。起另外一个变量名试试