IT. Expert System.

JQUERY

offset()


Description

The .offset() method sets or returns the offset (position) for the selected elements, relative to the document.


Return Offset Coordinates

Returns the offset coordinates of the FIRST matched element.

This method returns an object with 2 properties, top and left, which represent the top and left positions in pixels

v1.2

This method has the form:

.offset()

Return Value

This form returns an Object.


Set Offset Coordinates

Sets the offset coordinates of ALL matched elements

v1.4

This method has the alternate form:

.offset(value)
Parameter Description
value (required) Specifies the top and left coordinates in pixels.

Possible values:
  • Value pair, like {top:100,left:0}
  • An object with top and left properties

Return Value

This form returns a jQuery object.


Set Offset Coordinates Using a Function

Using a function to set the offset coordinates of ALL matched elements

v1.4

This method has the alternate form:

.offset(function(index,oldoffset))
Parameter Description
function(index,
oldoffset)
Specifies a function that returns an object containing the top and left coordinates.
  • index - (optional) Receives the index position of the selector
  • oldoffset - (optional) Receives the current coordinates of the selector

Return Value

This form returns a jQuery object.

Examples

Get the current offset position of a p element:

$("button").click(function(){
  x=$("p").offset();
  alert("Left offset: " + x.left + " Top offset: " + x.top);
});


Content

Android Reference

Java basics

Java Enterprise Edition (EE)

Java Standard Edition (SE)

SQL

HTML

PHP

CSS

Java Script

MYSQL

JQUERY

VBS

REGEX

C

C++

C#

Design patterns

RFC (standard status)

RFC (proposed standard status)

RFC (draft standard status)

RFC (informational status)

RFC (experimental status)

RFC (best current practice status)

RFC (historic status)

RFC (unknown status)

IT dictionary

License.
All information of this service is derived from the free sources and is provided solely in the form of quotations. This service provides information and interfaces solely for the familiarization (not ownership) and under the "as is" condition.
Copyright 2016 © ELTASK.COM. All rights reserved.
Site is optimized for mobile devices.
Downloads: 1254 / 158768626. Delta: 0.00354 с