News

Your Neighbor Ate Your Bird. Time To Get Revenge.

var heightAdjustment = 500;
var autoscroll = 1;
var scrollAdjustment = 100;
var myIframeTop = null;

window.addEventListener(‘message’, function(e) {

//var $iframe = jQuery(“#my_iframe”);
var eventName = e.data[0];
var data = e.data[1];
switch(eventName) {
case ‘setHeight’:
//$iframe.height(data);
fixData = data + heightAdjustment;
document.getElementById(“my_iframe”).style.height = fixData + “px”;
if(autoscroll){
window.scrollTo({
top: myIframeTop,
left: 0,
behavior: ‘smooth’
});
}
break;
}
}, false);

function EmbedTwineCacheIframe(){
var myIframeEl = document.getElementById(“my_iframe”);
var position = myIframeEl.getBoundingClientRect();
myIframeTop = position.top – scrollAdjustment;
}

setTimeout(EmbedTwineCacheIframe, 50);

Source

What's your reaction?

Excited
0
Happy
0
In Love
0
Not Sure
0
Silly
0

You may also like

More in:News

Leave a reply

Your email address will not be published. Required fields are marked *