Projet Socle ENT
Pages enfant
  • Retaillage d'iframe

Comparaison des versions

Légende

  • Ces lignes ont été ajoutées. Ce mot a été ajouté.
  • Ces lignes ont été supprimées. Ce mot a été supprimé.
  • La mise en forme a été modifiée.

...

Bloc de code
(function($){
    $(document).ready(function(){
            
        var resizeFrame = function(frame) {
                var height = $(frame).contents().find("html").attr('scrollHeight');
                if (height === undefined) return;

                // for firefox, one could use $(frame).contents().find("html").height()
                // which works without needing to set height to 0 first
                $(frame).css({height: 0});

                var height = $(frame).contents().find("html").attr('scrollHeight');
                if (height > 0) {
                    var horiz_scroll_heigth = 20;
                    $(frame).css({height: height + horiz_scroll_heigth});
                }
        };
  
        $('iframe').load(function() {
            resizeFrame(this);
        });
    });
})(jQuery);