BootWiki教程网
源代码:
点击运行
<!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>BootWiki 教程网</title> <script src="//cdn.staticfile.net/jquery/1.10.2/jquery.min.js"></script> <script> $(document).ready(function(){ $("button").click(function(){ newPos=new Object(); newPos.left="0"; newPos.top="100"; $("p").offset(newPos); }); }); </script> </head> <body> <p>这是一个段落。</p> <button>使用对象设置P元素的偏移坐标</button> </body> </html>
运行结果