JSONP

by Paco86

HTML

<div>
  <h1>
    haha
  </h1>
  
  <p>a</p>
  <p>b</p>
  <p>c</p>
  <p>d</p>
 
</div>

CSS

div {
  height: 999999px;
}

h1 {
  position: fixed;
  background: #efefef;
  width: 100%;
  
}
p {
  height: 500px;
  border: 1px solid #000;
 }

JavaScript

function t(promise, timeout) {
	return new Promise((resolve, reject) => {
  	setTimeout(reject, timeout);
    promise.then((data) => resolve(data), (error) => reject(error));
  });
}