| Server IP : 209.209.40.120 / Your IP : 216.73.217.112 Web Server : Microsoft-IIS/10.0 System : Windows NT NEWWWW 10.0 build 17763 (Windows Server 2019) i586 User : NEWWWW$ ( 0) PHP Version : 8.3.30 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : OFF | Perl : OFF | Python : OFF | Sudo : OFF | Pkexec : OFF Directory : C:/framework7/node_modules/framework7/modules/resize/ |
Upload File : |
import { getWindow, getDocument } from 'ssr-window';
import { getDevice } from '../../shared/get-device.js';
export default {
name: 'resize',
create() {
const app = this;
app.getSize = () => {
if (!app.el) return {
width: 0,
height: 0,
left: 0,
top: 0
};
const offset = app.$el.offset();
const [width, height, left, top] = [app.el.offsetWidth, app.el.offsetHeight, offset.left, offset.top];
app.width = width;
app.height = height;
app.left = left;
app.top = top;
return {
width,
height,
left,
top
};
};
},
on: {
init() {
const app = this;
const window = getWindow();
// Get Size
app.getSize();
// Emit resize
window.addEventListener('resize', () => {
app.emit('resize');
}, false);
// Emit orientationchange
window.addEventListener('orientationchange', () => {
app.emit('orientationchange');
});
},
orientationchange() {
const document = getDocument();
const device = getDevice();
// Fix iPad weird body scroll
if (device.ipad) {
document.body.scrollLeft = 0;
setTimeout(() => {
document.body.scrollLeft = 0;
}, 0);
}
},
resize() {
const app = this;
app.getSize();
}
}
};