Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal-3485117
Manage
Activity
Members
Labels
Plan
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Issue forks
drupal-3485117
Commits
24b02d36
Commit
24b02d36
authored
14 years ago
by
Dries Buytaert
Browse files
Options
Downloads
Patches
Plain Diff
- Rollback of
#787940
.
parent
2c39bc8e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
misc/displace.js
+0
-115
0 additions, 115 deletions
misc/displace.js
with
0 additions
and
115 deletions
misc/displace.js
deleted
100644 → 0
+
0
−
115
View file @
2c39bc8e
// $Id$
(
function
(
$
)
{
/**
* Provides a generic method to position elements fixed to the viewport.
*
* Fixed positioning (CSS declaration position:fixed) is done relative to the
* viewport. This makes it hard to position multiple fixed positioned element
* relative to each other (e.g. multiple toolbars should come after each other,
* not on top of each other).
*
* To position an element fixed at the top of the viewport add the class
* "displace-top" to that element, and to position it to the bottom of the view-
* port add the class "displace-bottom".
*
* When a browser doesn't support position:fixed (like IE6) the element gets
* positioned absolutely by default, but this can be overridden by using the
* "displace-unsupported" class.
*/
/**
* Attaches the displace behavior.
*/
Drupal
.
behaviors
.
displace
=
{
attach
:
function
(
context
,
settings
)
{
// Test for position:fixed support.
if
(
!
Drupal
.
positionFixedSupported
())
{
$
(
document
.
documentElement
).
addClass
(
'
displace-unsupported
'
);
}
$
(
document
.
body
).
once
(
'
displace
'
,
function
()
{
$
(
window
).
bind
(
'
resize.drupal-displace
'
,
function
()
{
Drupal
.
displace
.
clearCache
();
$
(
document
.
body
).
css
({
paddingTop
:
Drupal
.
displace
.
getDisplacement
(
'
top
'
),
paddingBottom
:
Drupal
.
displace
.
getDisplacement
(
'
bottom
'
)
});
});
});
Drupal
.
displace
.
clearCache
(
true
);
$
(
window
).
triggerHandler
(
'
resize
'
);
}
};
/**
* The displace object.
*/
Drupal
.
displace
=
Drupal
.
displace
||
{};
Drupal
.
displace
.
elements
=
[];
Drupal
.
displace
.
displacement
=
[];
/**
* Get all displaced elements of given region.
*
* @param region
* Region name. Either "top" or "bottom".
*
* @return
* jQuery object containing all displaced elements of given region.
*/
Drupal
.
displace
.
getDisplacedElements
=
function
(
region
)
{
if
(
!
this
.
elements
[
region
])
{
this
.
elements
[
region
]
=
$
(
'
.displace-
'
+
region
);
}
return
this
.
elements
[
region
];
};
/**
* Get the total displacement of given region.
*
* @param region
* Region name. Either "top" or "bottom".
*
* @return
* The total displacement of given region in pixels.
*/
Drupal
.
displace
.
getDisplacement
=
function
(
region
)
{
if
(
!
this
.
displacement
[
region
])
{
var
offset
=
0
;
var
height
=
0
;
this
.
getDisplacedElements
(
region
).
each
(
function
()
{
offset
=
offset
+
height
;
height
=
$
(
this
).
css
(
region
,
offset
).
outerHeight
();
// In IE, Shadow filter adds some extra height, so we need to remove it
// from the returned height.
if
(
this
.
filters
&&
this
.
filters
.
length
&&
this
.
filters
.
item
(
'
DXImageTransform.Microsoft.Shadow
'
))
{
height
-=
this
.
filters
.
item
(
'
DXImageTransform.Microsoft.Shadow
'
).
strength
;
}
});
// Use offset of latest displaced element as the total displacement.
this
.
displacement
[
region
]
=
offset
+
height
;
}
return
this
.
displacement
[
region
];
};
/**
* Clear cache.
*
* @param selectorCache
* Boolean whether to also clear the selector cache.
*/
Drupal
.
displace
.
clearCache
=
function
(
selectorCache
)
{
if
(
selectorCache
)
{
this
.
elements
=
[];
}
this
.
displacement
=
[];
};
})(
jQuery
);
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment