Dimitris Leventeas
Dimitris Leventeas

Reputation: 1702

Scale down iframe (preview webpage)

How could I create a preview of a webpage? Using iframe, I could not scale down the contents of the page in order to create a nice looking overview.

The following fails

<iframe src="/mplahmplah#important_stuff" style="width:700px; height:900px; -moz-transform:scale(0.15, 0.15)" sandbox="" seamless scrolling="no"></iframe>

Upvotes: 0

Views: 1017

Answers (1)

davids
davids

Reputation: 6371

If the domain of the iframe and the container page is the same and you are using jQuery, try something like this:

$(function(){
    $('iframe').on('load', function(){
        $(this).contents().find('body').css({'-webkit-transform':'scale(0.15, 0.15)', '-moz-transform':'scale(0.15, 0.15)'}); 
    });
});

The point is that you don't want to scale the iframe, you want to scale it's contents.

Upvotes: 1

Related Questions