• Home
  • Website Thumbnail iFrames

    Method from https://medium.com/@jamesfuthey/simulating-the-creation-of-website-thumbnail-screenshots-using-iframes-7145269891db

    Embedding these (and Otterframes or other iFrames) in Popup Footnotes and Slide-Ins is good, as the remote sites only load when triggered and do not slow down the site.

    <div style="text-align:center">
    <a href="https://microchic.fm" rel="dd">
    <div class="i-thumbnail-container" title="https://microchic.fm -->">
    <div class="i-thumbnail">
      <iframe src="https://microchic.fm/" frameborder="0" onload="var that=this;setTimeout(function() { that.style.opacity = 1 }, 500)"></iframe>
    </div>
    </div>
    </a>
    
    <a href="https://microchic.me" rel="dd">
    <div class="i-thumbnail-container" title="https://microchic.me -->">
    <div class="i-thumbnail">
      <iframe src="https://microchic.me/" frameborder="0" onload="var that=this;setTimeout(function() { that.style.opacity = 1 }, 500)"></iframe>
    </div>
    </div>
    </a>
    </div>
    <style> /* This is the contents of /partials/iframe-thumbnail.hbs (included in post.hbs) */
    
    /* This container helps the thumbnail behave as if it were an unscaled IMG element */
    .i-thumbnail-container {
      width: calc(1440px * 0.25);
      height: calc(900px * 0.25);
      display: inline-block;
      overflow: hidden;
      position: relative;
      background: #f9f9f9;
    }
    /* Image Icon for the Background */
    .i-thumbnail-container::before {
      position: absolute;
      left: calc(50% - 16px);
      top: calc(50% - 18px);
      opacity: 0.2;
      display: block;
      -ms-zoom: 2;
      -o-transform: scale(2);
      -moz-transform: scale(2);
      -webkit-transform: scale(2);
      content: url("data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiA/PjwhRE9DVFlQRSBzdmcgIFBVQkxJQyAnLS8vVzNDLy9EVEQgU1ZHIDEuMS8vRU4nICAnaHR0cDovL3d3dy53My5vcmcvR3JhcGhpY3MvU1ZHLzEuMS9EVEQvc3ZnMTEuZHRkJz48c3ZnIGVuYWJsZS1iYWNrZ3JvdW5kPSJuZXcgMCAwIDMyIDMyIiBoZWlnaHQ9IjMycHgiIGlkPSJMYXllcl8xIiB2ZXJzaW9uPSIxLjEiIHZpZX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EuNjU2LDAsMy0xLjM0MywzLTNzLTEuMzQ0LTMtMy0zYy0xLjY1OCwwLTMsMS4zNDMtMywzUzE4LjM0MiwxMywyMCwxM3ogTTIwLDhjMS4xMDIsMCwyLDAuODk3LDIsMiAgIHMtMC44OTgsMi0yLDJjLTEuMTA0LDAtMi0wLjg5Ny0yLTJTMTguODk2LDgsMjAsOHoiIGZpbGw9IiMzMzMzMzMiLz48L2c+PC9zdmc+");
    }
    /* This is a masking container for the zoomed iframe element */
    .i-thumbnail {
      -ms-zoom: 0.25;
      -moz-transform: scale(0.25);
      -moz-transform-origin: 0 0;
      -o-transform: scale(0.25);
      -o-transform-origin: 0 0;
      -webkit-transform: scale(0.25);
      -webkit-transform-origin: 0 0;
    }
    /* This is our screen sizing */
    .i-thumbnail,
    .i-thumbnail iframe {
      width: 1440px;
      height: 900px;
    }
    /* This facilitates the fade-in transition instead of flicker. It also helps us maintain the illusion that this is an image, since some webpages will have a preloading animation or wait for some images to download */
    .i-thumbnail iframe {
      opacity: 0;
      transition: all 300ms ease-in-out;
    }
    /* This pseudo element masks the iframe, so that mouse wheel scrolling and clicking do not affect the simulated "screenshot" */
    .i-thumbnail:after {
      content: "";
      display: block;
      position: absolute;
      top: 0;
      left: 0;
      right: 0;
      bottom: 0;
    }
    
    </style>

    Page Contents