Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <style>
- #banner_ict {
- display: inline-block;
- min-height: 200px;
- height: 200px;
- width: 100%;
- overflow: hidden;
- }
- #banner_ict ins a img {
- transform: translateY(-533px);
- }
- #banner_ict ins iframe {
- width: 300px;
- }
- </style>
- <div id="banner_ict" style="display: none">
- <ins data-revive-zoneid="2" data-revive-id="bdd66532c84f3e252b918b835af34252"></ins>
- <script async src="//ads.ictglobus.com/www/delivery/asyncjs.php"></script></div>
- <script type="text/javascript">
- var startedAsMobile = false;
- var adSense = false;
- (function() {
- var lastTime = 0;
- var vendors = ['ms', 'moz', 'webkit', 'o'];
- for(var x = 0; x < vendors.length && !window.requestAnimationFrame; ++x) {
- window.requestAnimationFrame = window[vendors[x]+'RequestAnimationFrame'];
- window.cancelAnimationFrame = window[vendors[x]+'CancelAnimationFrame']
- || window[vendors[x]+'CancelRequestAnimationFrame'];
- }
- if (!window.requestAnimationFrame)
- window.requestAnimationFrame = function(callback, element) {
- var currTime = new Date().getTime();
- var timeToCall = Math.max(0, 16 - (currTime - lastTime));
- var id = window.setTimeout(function() { callback(currTime + timeToCall); },
- timeToCall);
- lastTime = currTime + timeToCall;
- return id;
- };
- if (!window.cancelAnimationFrame)
- window.cancelAnimationFrame = function(id) {
- clearTimeout(id);
- };
- }());
- function frameRequest() {
- if(startedAsMobile) {
- var bannerTop = document.getElementById("banner_ict").offsetTop;
- var wind = window.screen.height;
- var pos = window.scrollY;
- var newPos = -wind + ( wind + pos - bannerTop);
- if(window.screen.width <= 769)
- document.querySelector('#banner_ict').style.display = 'block';
- else
- document.querySelector('#banner_ict').style.display = 'none';
- if(!adSense)
- document.querySelector('#banner_ict ins a img').style.transform = 'translateY('+newPos+'px)';
- else
- document.querySelector('#banner_ict ins iframe').contentWindow.document.body.querySelector('.adsbygoogle iframe').style.top = newPos+'px';
- }
- }
- jQuery(document).ready(function() {
- if(window.screen.width <= 769)
- {
- startedAsMobile = true;
- document.querySelector('#banner_ict').style.display = 'block';
- window.onresize = function() {
- if(window.screen.width <= 769)
- document.querySelector('#banner_ict').style.display = 'block';
- else
- document.querySelector('#banner_ict').style.display = 'none';
- }
- var stillloading = setInterval(function() {
- if(document.querySelector('#banner_ict ins a img') != null)
- {
- clearInterval(stillloading);
- adSense = false;
- document.querySelector('#banner_ict ins a img').offsetWidth = window.screen.width;
- document.querySelector('#banner_ict ins a img').style.height = window.screen.height+"px";
- document.querySelector('#banner_ict ins a img').style.minHeight = window.screen.height+"px";
- document.querySelector('#banner_ict ins a img').style.maxHeight = window.screen.height+"px";
- var parChilds = document.querySelector('.field-name-field-fulltext .field-items .field-item.odd').childNodes;
- var elP = parChilds[Math.round(parChilds.length / 2) + 1];
- document.querySelector('.field-name-field-fulltext .field-items .field-item.odd').insertBefore(document.getElementById('banner_ict'), elP);
- window.requestAnimationFrame(frameRequest);
- window.onscroll = function() {
- window.requestAnimationFrame(frameRequest);
- };
- }
- else if((typeof window.adsbygoogle !== 'undefined' && window.adsbygoogle.loaded) || (document.querySelector('#banner_ict ins iframe') !== null && (document.querySelector('#banner_ict ins iframe').contentWindow.document.body.querySelector('.adsbygoogle') != null)))
- {
- if(document.querySelector('#banner_ict ins iframe').contentWindow.document.body.querySelector('.adsbygoogle iframe') != null)
- {
- clearInterval(stillloading);
- adSense = true;
- document.querySelector('#banner_ict ins iframe').contentWindow.document.body.querySelector('.adsbygoogle iframe').offsetWidth = window.screen.width;
- document.querySelector('#banner_ict ins iframe').contentWindow.document.body.querySelector('.adsbygoogle iframe').style.height = window.screen.height+"px";
- document.querySelector('#banner_ict ins iframe').contentWindow.document.body.querySelector('.adsbygoogle iframe').style.minHeight = window.screen.height+"px";
- document.querySelector('#banner_ict ins iframe').contentWindow.document.body.querySelector('.adsbygoogle iframe').style.maxHeight = window.screen.height+"px";
- window.requestAnimationFrame(frameRequest);
- window.onscroll = function() {
- window.requestAnimationFrame(frameRequest);
- };
- }
- }
- }, 200);
- }
- });
- </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement