获取或设置指定元素边框的viewport位置。
geom.boundingPosition(elm,coords)
Example: 设置 div 容器的 top 与 left 参数值,参数是最终结果位置,包含外边距的大小。
<!DOCTYPE html> <html> <head> <style> .border {height: 50px;width:50px;margin: 30px;padding: 20px; border: 2px solid red;} </style> <script type="text/javascript" src="https://cdnjs.cloudflare.com/ajax/libs/require.js/2.3.3/require.min.js"></script> <script> require.config({ baseUrl: "./", packages: [{ name: "skylark", location: "../../../src/skylark" }, ] }); </script> </head> <body> bounding postition : <div class="border"></div> <script> require(["skylark/query","skylark/finder", "skylark/geom", "skylark/datax"], function($,finder, geom, datax) { geom.boundingPosition(finder.find("div"),{top:100,left:100}); }); </script> </body> </html>