从jQuery获取偏移值 [英] To get the offset values from jquery

查看:146
本文介绍了从jQuery获取偏移值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何找到表格中随附的图像的偏移值.该表包含很多图像.我想要将偏移量-悬停在图像中时,所有图像的左,右,上,下. 我在jquery中需要这个

How do i find the offset value of an image, which is enclosed with in a table. The table consist of lot of images. i want to get the offset - left, right, top, bottom for all the image while hover into the image. I need this in jquery

谢谢,
Praveen J

Thanks,
Praveen J

推荐答案

var elem = $("your_element");
var offset = elem.offset();
var leftValue = offset.left;
var topValue =  offset.top;

要获取正确的值和底部的值,请在左侧和顶部添加宽度和高度的值.

To get right and bottom values add width and height values to left and top..

这篇关于从jQuery获取偏移值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆