So I am trying to create a way to detect when the body resizes and then I grab the new height and send it through a postmessage. The not correctly functioning part is when I downsize the body ( when I removed(hide) some elements so the body shrunk). This does not get detected as the window.body.scrollHeight simply holds the last value. Here is my code and I would appreciate any suggestions:
sendMessage();
checkDocumentHeight(sendMessage);
function sendMessage(){
var heightWidth = document.body.scrollHeight+ " " +document.body.scrollWidth;
parent.postMessage(heightWidth, "*");
}
function checkDocumentHeight(callback){
var lastHeight = document.body.scrollHeight, newHeight, timer;
(function run(){
newHeight = document.body.scrollHeight;
if( lastHeight != newHeight )
callback();
lastHeight = newHeight;
timer = setTimeout(run, 1000);
})();
}
I made a Character class shared by the client and server in the same js file. The server instanciates these characters and stocks them in a characterList object. I send it to the client with socket....
I made a Character class shared by the client and server in the same js file. The server instanciates these characters and stocks them in a characterList object. I send it to the client with socket....
I have two divs <div class="tab-pane active" id="home"> <div class="tab-pane" id="profile"> Each of this div has forms in it which has a hidden field <input type="hidden" name="...
I have two divs <div class="tab-pane active" id="home"> <div class="tab-pane" id="profile"> Each of this div has forms in it which has a hidden field <input type="hidden" name="...
Currently I am using React on Rails application (using react-rails library) and I wish to use some third party React components. How to use third party component without adding dependency to ...
Currently I am using React on Rails application (using react-rails library) and I wish to use some third party React components. How to use third party component without adding dependency to ...
Update: A Solution below! I'm fairly new to website development but I've been tasked with developing e2e (end-to-end) tests for a developing website that uses AngularJS. As a result I've been looking ...
Update: A Solution below! I'm fairly new to website development but I've been tasked with developing e2e (end-to-end) tests for a developing website that uses AngularJS. As a result I've been looking ...