mirror of
https://github.com/lllyasviel/Fooocus.git
synced 2026-08-16 13:13:16 +02:00
add some javascripts
add some javascripts
This commit is contained in:
@@ -0,0 +1,37 @@
|
||||
window.main_viewer_height = 512;
|
||||
|
||||
function resized() {
|
||||
let windowHeight = window.innerHeight - 260;
|
||||
let elements = document.getElementsByClassName('main_view');
|
||||
|
||||
if (windowHeight > 745) windowHeight = 745;
|
||||
|
||||
for (let i = 0; i < elements.length; i++) {
|
||||
elements[i].style.height = windowHeight + 'px';
|
||||
}
|
||||
|
||||
window.main_viewer_height = windowHeight;
|
||||
}
|
||||
|
||||
function viewer_to_top(delay = 100) {
|
||||
setTimeout(() => window.scrollTo({top: 0, behavior: 'smooth'}), delay);
|
||||
}
|
||||
|
||||
function viewer_to_bottom(delay = 100) {
|
||||
let element = document.getElementById('positive_prompt');
|
||||
let yPos = window.main_viewer_height;
|
||||
|
||||
if (element) {
|
||||
yPos = element.getBoundingClientRect().top + window.scrollY;
|
||||
}
|
||||
|
||||
setTimeout(() => window.scrollTo({top: yPos - 8, behavior: 'smooth'}), delay);
|
||||
}
|
||||
|
||||
window.addEventListener('resize', (e) => {
|
||||
resized();
|
||||
});
|
||||
|
||||
onUiLoaded(async () => {
|
||||
resized();
|
||||
});
|
||||
Reference in New Issue
Block a user