c# - properly sizing an iframe that holds images of unknown dimensions -


I have a C # web browser that has an HTML page that has several iframes. Every IFrame often has an arbitrary HTML file with images. The IIG tag often has no width or height (i.e., it is often just & lt; img src = "someimage.jpg" & gt; ).

How do I read about size iframes based on my shape, and it has got to work using jquery The following jquery snippet is present in the html of iframe:

 
$ (document) .ready (function () {$ ('img'). Each (function () {$ (this)) Tie ('Load Ready' ', function (e) {var iframes = window Top.document.getElementsByName (window.name); if (iframes.length == 1) {window.top.DoResizeFrame (iframes [0]);}}}})

DoResizeFrame Is defined in the original HTML file (it is showing webbrowser):

  functions Cause DoResizeFrame (fr) {If (fr & amp; amp; dot & amp; document & amp; amp; fr.Document.body) {fr.style.height = fr.Document.body.scrollHeight + 'px'; fr .style.width = fr.documentation.body.scrollWidth + 'px';}} I also call DoResizeFrame from the $ $ $ document $ $. Now the event. It works great - if there is no image, then Document is ready The event changes in size one IF images, every time an image is loaded, iframe is properly resized.  

However, loading a large image causes the iframe to be improperly shaped until the image is fully loaded. Since the width and height of the image tag are rarely affected by the fact that I have to work, I thought that I can use jquery to listen to the whole story of the image and when it is "loading", then Size the image and pick up the size. Iframe is still loading when the image is still loading Unfortunately, at least in IE7, the finished Stack = loading only occurs when the image is downloaded.

Does anybody have any idea that I have the size of an image referenced in my HTML, "> Without waiting for? I am trying to provide the best user experience by shaping everything correctly, so that the user can read the rest of the IFrame, even if it is taking a while to download a large image.

Thank you! Jean

A reliable way of ensuring that the server asks for the image size before downloading it I have used it on the net, it is quite easy.


Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -