jquery设置控件位置的方法
纯JS写法:
document.getElementById("child").style.left="800px";
document.getElementById("child").style.top="200px";*/
//offset()获取当前元素基于浏览的位置
var offsettop=$("#unamespan").offset().top;
var offsetleft=$("#unamespan").offset().left;
//position()获取当前元素基于父容器的位置
var positiontop=$("#unamespan").position().top;
var positionleft=$("#unamespan").position().left;
//设置panel2的位置基于unamespan的坐标
$("#panel2").css({position: "absolute",'top':offsettop+100,'left':offsetleft+50,'z-index':2});
您可能感兴趣的文章:
jquery设置控件位置的方法
动态加载用户控件(整理)
ExtJS设置与获取radio控件的选取状态
jquery实现的元素的left增加N像素 鼠标移开会慢慢的移动到原来的位置
Jquery easyui之控件参数传递方法
asp.net 用户控件中图片与样式引用的问题
jQuery选中select控件 无法设置selected的解决方法
js获取控件位置的方法
jQuery气泡提示插件 Grumble.js
锋利的jQuery 要点归纳(二) jQuery中的DOM操作(下)