ничего не изменилось.
|
JohnJohn,
а так? window.onscroll = window.resize = |
пробовал, тоже нет(
|
JohnJohn,
можно только гадать в чём у вас проблема? |
вот код.
<html> <head> <style> html, body { height: 100%; } .main { height: 100%; } .second_block { height: 100%; } #download_present_img{ position: fixed; z-index: 9999; right: 15px; bottom: 20px; font-size: 50px; font-style: normal; margin-left: 20px; width: 40px; height: 40px; background: red; } .footer_block { display: flex; flex-flow: column nowrap; justify-content: center; align-items: center; position: relative; height: 190px; bottom: 0; left: 0; } .footer { color: #ffffff; display: flex; flex-flow: column nowrap; justify-content: center; align-items: center; position: absolute; left: 0; bottom: 0; width: 100%; height: 190px; background: #000; } </style> </head> <body> <div class="main"></div> <div class='second_block'> <div id="download_present_img"></div> </div> <div id="footer_stop" class="footer_block"> <div class="footer"> <div class="text_footer"> <p>footer</p> </div> </div> </div> <script> function offset(a) { for (var b = 0; a;) b += parseInt(a.offsetTop), a = a.offsetParent; return b } var s = !0; window.onload = function () { var a = document.getElementById("download_present_img"), b = offset(a), f = window.getComputedStyle ? getComputedStyle(a, "") : a.currentStyle, d = a.offsetHeight + parseInt(f.marginTop) || 0, e = offset(document.getElementById("footer_stop")); window.onscroll = window.resize = function () { var c = window.pageYOffset || document.documentElement.scrollTop, c = e - (c + d + b); s != 0 < c && ((s = 0 < c) ? (a.style.top = b + "px", a.style.position = "fixed") : (a.style.top = e - d + "px", a.style.position = "absolute")) } }; </script> </body> </html> |
JohnJohn,
вариант... <!DOCTYPE html> <html> <head> <style> html, body { height: 100%; } .main { height: 100%; } .second_block { height: 100%; } #download_present_img{ position: fixed; z-index: 9999; right: 15px; bottom: 20px; font-size: 50px; font-style: normal; margin-left: 20px; width: 40px; height: 40px; background: red; } .footer_block { display: flex; flex-flow: column nowrap; justify-content: center; align-items: center; position: relative; height: 190px; bottom: 0; left: 0; } .footer { color: #ffffff; display: flex; flex-flow: column nowrap; justify-content: center; align-items: center; position: absolute; left: 0; bottom: 0; width: 100%; height: 190px; background: #000; } </style> </head> <body> <div class="main"></div> <div class='second_block'> <div id="download_present_img"></div> </div> <div id="footer_stop" class="footer_block"> <div class="footer"> <div class="text_footer"> <p>footer</p> </div> </div> </div> <script> function offset(a) { for (var b = 0; a;) b += parseInt(a.offsetTop), a = a.offsetParent; return b } var s = !0; window.onload = function () { var a = document.getElementById("download_present_img"), b = offset(a), f = window.getComputedStyle ? getComputedStyle(a, "") : a.currentStyle, d = a.offsetHeight + parseInt(f.marginTop) || 0, e = offset(document.getElementById("footer_stop")); window.onresize = function() { window.scrollTo(0,0); s = !0; a.style.position = "fixed"; a.style.top = ""; b = offset(a); e = offset(document.getElementById("footer_stop")); }; window.onscroll = function () { var c = window.pageYOffset || document.documentElement.scrollTop, c = e - (c + d + b); s != 0 < c && ((s = 0 < c) ? (a.style.top = b + "px", a.style.position = "fixed") : (a.style.top = e - d + "px", a.style.position = "absolute")) } }; </script> </body> </html> |
Хороший вариант... И как вам это в голову приходит!?! Спасибо.
|
Цитата:
Цитата:
|
EvgenyTryap,
сделайте минимальный макет, иначе можно только гадать. |
content.addEventListener(\'scroll\' |
Часовой пояс GMT +3, время: 02:26. |