116 lines
3.2 KiB
HTML
116 lines
3.2 KiB
HTML
<!DOCTYPE html>
|
|
<html>
|
|
<head>
|
|
<title>wikiframe test 3</title>
|
|
<meta name="viewport" content="width=device-width">
|
|
<meta charset="utf-8">
|
|
<style type="text/css">
|
|
body {
|
|
overflow: hidden;
|
|
background: pink;
|
|
}
|
|
#map {
|
|
position: absolute;
|
|
left: 0; top: 0;
|
|
bottom: 40vh; right: 0;
|
|
z-index: 0;
|
|
background: black;
|
|
}
|
|
#map #radio {
|
|
position: absolute;
|
|
left: 10px;
|
|
bottom: 10px;
|
|
width: 360px;
|
|
height: 60px;
|
|
}
|
|
#map a {
|
|
position: relative;
|
|
left: 200px;
|
|
top: 200px;
|
|
}
|
|
#pagediv {
|
|
position: absolute;
|
|
left: 0; top: 0;
|
|
bottom: 0; right: 0;
|
|
z-index: 0;
|
|
overflow: auto;
|
|
}
|
|
#page {
|
|
position: absolute;
|
|
left: 0; right: 0;
|
|
top: 60vh;
|
|
height: 100vh;
|
|
}
|
|
#page iframe {
|
|
width: 100%;
|
|
height: 100%;
|
|
border: none;
|
|
overflow: hidden;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div id="pagediv">
|
|
<div id="map"><a href="#">map</a>
|
|
|
|
<div id="radio"><iframe width="100%" height="60" src="https://www.mixcloud.com/widget/iframe/?hide_cover=1&mini=1&feed=%2FErgote_Radio%2Fmagma-reclaim-the-climax-publication-exposition-documentation%2F" frameborder="0" ></iframe></div>
|
|
</div>
|
|
<div id="page">
|
|
<iframe src="/mw"></iframe>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
<script>
|
|
(function () {
|
|
|
|
var pagediv = document.querySelector("#pagediv"),
|
|
page = document.querySelector("#page"),
|
|
iframe = document.querySelector("iframe"),
|
|
scroll_elt = pagediv;
|
|
|
|
pagediv.scrollTop = 0;
|
|
|
|
pagediv.addEventListener("scroll", function () {
|
|
var sh = pagediv.scrollHeight,
|
|
sp = pagediv.scrollTop;
|
|
console.log("scroll", sp, sh);
|
|
if (pagediv.scrollHeight - pagediv.scrollTop === pagediv.clientHeight) {
|
|
console.log("END OF SCROLL");
|
|
set_scroll_elt(iframe);
|
|
}
|
|
});
|
|
|
|
function set_scroll_elt (elt) {
|
|
if (scroll_elt === elt) { return; }
|
|
scroll_elt = elt;
|
|
if (scroll_elt === pagediv) {
|
|
pagediv.scrollTop = pagediv.scrollHeight - pagediv.clientHeight - 10;
|
|
pagediv.style.overflow = "auto";
|
|
iframe.contentWindow.document.body.style.overflow = "hidden";
|
|
} else {
|
|
pagediv.style.overflow = "hidden";
|
|
iframe.contentWindow.document.body.style.overflow = "auto";
|
|
}
|
|
}
|
|
|
|
iframe.addEventListener("load", function () {
|
|
// var ifh = iframe.contentWindow.document.body.scrollHeight;
|
|
var ifbody = iframe.contentWindow.document.body;
|
|
var sd = iframe.contentDocument.scrollingElement
|
|
console.log("scrolling element", sd);
|
|
ifbody.style.overflow = "hidden";
|
|
iframe.contentWindow.addEventListener("scroll", function () {
|
|
var stm = sd.scrollHeight - sd.clientHeight;
|
|
console.log("pagescroll", sd.scrollTop, stm);
|
|
if (sd.scrollTop == 0) {
|
|
set_scroll_elt(pagediv);
|
|
}
|
|
})
|
|
// console.log("load", ifh);
|
|
// page.style.height = ifh+"px";
|
|
});
|
|
|
|
})
|
|
|
|
</script>
|
|
</html> |