0

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>
Community
  • 1
  • 1
dw03
  • 11
  • 1
  • 3

1 Answers1

0

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

Community
  • 1
  • 1
Shakakai
  • 3,514
  • 1
  • 16
  • 18
  • Thanks. I'm still a real newbie when it comes to JS, can you show me how do I write a loop that changes the src attribute of the iframe? – dw03 Feb 10 '11 at 18:32
  • Do you mean "loop" as in a "for" loop? Or the user clicks on a button and you switch all the iframe thumbnails out for a new "src"? – Shakakai Feb 10 '11 at 18:37
  • Nevermind, I figured it out. I think I am going to have to use the original scaling method because the one you posted doesn't work with IE8. – dw03 Feb 10 '11 at 18:56
  • Yea, you can tweak ".tab iframe"'s scale properties: -webkit-transform, -moz-transform, transform – Shakakai Feb 10 '11 at 19:04
  • Hm...so using a static scaling value is not working too well because the pages are much different sizes. Is there a way to dynamically scale to a fixed resolution? I don't mind if it stretches. Thanks – dw03 Feb 10 '11 at 19:13
  • Do you know what the pages are in advance? Could you just apply a different style class to the iframe based on the scale you need? – Shakakai Feb 10 '11 at 19:19
  • Yes, I posted the code above (with random links, assume each link is a picture with a different resolution). Can you explain to me how I can change the style class based on what is next? I just don't know how to sync the CSS and Java. Thanks – dw03 Feb 10 '11 at 20:23