mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
@ -273,18 +273,8 @@ export function flushDimensionCache() {
|
|||||||
let dimensionCache = {};
|
let dimensionCache = {};
|
||||||
let dimensionIds = 0;
|
let dimensionIds = 0;
|
||||||
|
|
||||||
function getStyle(el, cssprop) {
|
|
||||||
if (el.currentStyle) { //IE
|
|
||||||
return el.currentStyle[cssprop];
|
|
||||||
} else if (window.getComputedStyle) {
|
|
||||||
return window.getComputedStyle(el)[cssprop];
|
|
||||||
}
|
|
||||||
// finally try and get inline style
|
|
||||||
return el.style[cssprop];
|
|
||||||
}
|
|
||||||
|
|
||||||
function isStaticPositioned(element) {
|
function isStaticPositioned(element) {
|
||||||
return (getStyle(element, 'position') || 'static') === 'static';
|
return (element.style.position || 'static') === 'static';
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -317,8 +307,8 @@ export function position(element) {
|
|||||||
|
|
||||||
var boundingClientRect = element.getBoundingClientRect();
|
var boundingClientRect = element.getBoundingClientRect();
|
||||||
return {
|
return {
|
||||||
width: boundingClientRect.width || element.prop('offsetWidth'),
|
width: boundingClientRect.width || element.offsetWidth,
|
||||||
height: boundingClientRect.height || element.prop('offsetHeight'),
|
height: boundingClientRect.height || element.offsetHeight,
|
||||||
top: elBCR.top - offsetParentBCR.top,
|
top: elBCR.top - offsetParentBCR.top,
|
||||||
left: elBCR.left - offsetParentBCR.left
|
left: elBCR.left - offsetParentBCR.left
|
||||||
};
|
};
|
||||||
@ -333,8 +323,8 @@ export function position(element) {
|
|||||||
export function offset(element) {
|
export function offset(element) {
|
||||||
var boundingClientRect = element.getBoundingClientRect();
|
var boundingClientRect = element.getBoundingClientRect();
|
||||||
return {
|
return {
|
||||||
width: boundingClientRect.width || element.prop('offsetWidth'),
|
width: boundingClientRect.width || element.offsetWidth,
|
||||||
height: boundingClientRect.height || element.prop('offsetHeight'),
|
height: boundingClientRect.height || element.offsetHeight,
|
||||||
top: boundingClientRect.top + (window.pageYOffset || document.documentElement.scrollTop),
|
top: boundingClientRect.top + (window.pageYOffset || document.documentElement.scrollTop),
|
||||||
left: boundingClientRect.left + (window.pageXOffset || document.documentElement.scrollLeft)
|
left: boundingClientRect.left + (window.pageXOffset || document.documentElement.scrollLeft)
|
||||||
};
|
};
|
||||||
|
Reference in New Issue
Block a user