Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jquery
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
夏彬
jquery
Commits
ac324c97
Commit
ac324c97
authored
May 14, 2008
by
Ariel Flesler
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
jquery offset: reducing the code size.
parent
f717260e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
10 additions
and
10 deletions
+10
-10
offset.js
src/offset.js
+10
-10
No files found.
src/offset.js
View file @
ac324c97
...
@@ -101,23 +101,23 @@ jQuery.fn.offset = function() {
...
@@ -101,23 +101,23 @@ jQuery.fn.offset = function() {
jQuery
.
fn
.
extend
({
jQuery
.
fn
.
extend
({
position
:
function
()
{
position
:
function
()
{
var
left
=
0
,
top
=
0
,
elem
=
this
[
0
],
offset
,
parentOffset
,
offsetParent
,
results
;
var
left
=
0
,
top
=
0
,
results
;
if
(
elem
)
{
if
(
this
[
0
]
)
{
// Get *real* offsetParent
// Get *real* offsetParent
offsetParent
=
this
.
offsetParent
();
var
offsetParent
=
this
.
offsetParent
(),
// Get correct offsets
// Get correct offsets
offset
=
this
.
offset
();
offset
=
this
.
offset
(),
parentOffset
=
offsetParent
.
offset
();
parentOffset
=
offsetParent
.
offset
();
// Subtract element margins
// Subtract element margins
offset
.
top
-=
parseInt
(
jQuery
.
curCSS
(
elem
,
'marginTop'
,
true
)
)
||
0
;
offset
.
top
-=
num
(
this
,
'marginTop'
)
;
offset
.
left
-=
parseInt
(
jQuery
.
curCSS
(
elem
,
'marginLeft'
,
true
)
)
||
0
;
offset
.
left
-=
num
(
this
,
'marginLeft'
)
;
// Add offsetParent borders
// Add offsetParent borders
parentOffset
.
top
+=
parseInt
(
jQuery
.
curCSS
(
offsetParent
[
0
],
'borderTopWidth'
,
true
)
)
||
0
;
parentOffset
.
top
+=
num
(
offsetParent
,
'borderTopWidth'
)
;
parentOffset
.
left
+=
parseInt
(
jQuery
.
curCSS
(
offsetParent
[
0
],
'borderLeftWidth'
,
true
)
)
||
0
;
parentOffset
.
left
+=
num
(
offsetParent
,
'borderLeftWidth'
)
;
// Subtract the two offsets
// Subtract the two offsets
results
=
{
results
=
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment