Advertisement
Guest User

Untitled

a guest
Aug 11th, 2015
344
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
HTML 1.49 KB | None | 0 0
  1. // iframe
  2.  
  3. <script type="text/javascript">
  4.                 $('.tooltip').remove();
  5.  
  6.         (function() {
  7.     var $win = $(window),
  8.         $doc = $(document);
  9.     function sendContentHeight() {
  10.         if (window.parent && window.parent.postMessage) {
  11.            window.parent.postMessage(JSON.stringify({ type: 'elasticframe', height: $doc.height() }), '*');
  12.         }
  13.     }
  14.  
  15.     $win.load(sendContentHeight);
  16.     $doc.load(sendContentHeight);
  17.     $doc.ready(sendContentHeight);
  18.     $win.resize(sendContentHeight);
  19. }());
  20.     </script>
  21.  
  22.  
  23. // outside
  24.  
  25. <script>
  26.     (function() {
  27.         function setIframeHeight(ev) {
  28.             var data;
  29.             try {
  30.                 data = JSON.parse(ev.data);
  31.             } catch(e) {}
  32.  
  33.             if (typeof data === 'object' && data.type === 'elasticframe' && typeof parseInt(data.height) === 'number') {
  34.                document.getElementById('bild-channelizer').style.height = parseInt(data.height || 1800) + 'px';
  35.             }
  36.         }
  37.  
  38.         function resetIframeHeight() {
  39.             document.getElementById('bild-channelizer').style.height = 'auto';
  40.         }
  41.  
  42.         if (window.addEventListener) {
  43.             window.addEventListener('orientationchange', resetIframeHeight);
  44.             window.addEventListener('message', setIframeHeight);
  45.         } else {
  46.             window.attachEvent('onorientationchange', resetIframeHeight);
  47.             window.attachEvent('onmessage', setIframeHeight);
  48.         }
  49.     }());
  50. </script>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement