Cycle scaled webpages in iframe?

2019-09-01 02:53发布

问题:

I'm trying to combine code from two questions previously asked here before. How can I cycle through pages? I want to use this code to create a kiosk and cycle through webpages. I also want to use How can I scale the content of an iframe? this to scale the content of the iframe. Ideally I would like to scale each page by a different factor, but if this is not possible then I will use a static value. On a side note, is it possible to scale the page automatically to a certain screen resolution or will I have to keep trying factors until I find an ideal one? Thanks

<style>
#wrap { width: 1390px; height: 690px; padding: 0; overflow: hidden; }
#frame { width: 1390px; height: 690px; border: 0px solid black; }
#frame { zoom: 2; -moz-transform: scale(2); -moz-transform-origin: 0 0; }
</style>
<script type="text/javascript">
    var frames = Array('http://www.google.com, 5,
                       'http://www.yahoo.com', 5,
                       'http://www.ebay.com', 5);

var i = 0, len = frames.length;
function ChangeSrc()
{
if (i >= len) { i = 0; }
  document.getElementById('frame').src = frames[i++];
  setTimeout('ChangeSrc()', (frames[i++]*1000));
}
window.onload = ChangeSrc;
</script>
</head>

<body>
<div id="wrap">
    <iframe src="" id="frame" scrolling="no" frameborder="0"></iframe>
</div>
</body>
</html>

回答1:

I'd suggest you use this approach: http://forrst.com/posts/css3_dynamic_website_thumbnails_with_an_iframe-CGk

You can cycle through pages by changing the src attribute of the iframe:

document.getElementById('myIframe').src = 'newPage.html';

This question is also pretty useful: jQuery Webpage Preview