嘿,我正在尝试制作一个小功能,我可以点击一个图标,然后会出现一个类似于灯箱的框,但是它固定在图标上.有办法吗?
谢谢!
// 1.Tell where the icon is on the screen
var off = $("#iconId").offset();
// 2.Have the top left corner of my box placed where the icon is
var div = $("#divId");
div.css({ position: "absolute", top: off.top, left: off.left });
// 3.Have my box appear in that location?
div.show();
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
721 次 |
| 最近记录: |