html


Make image size responsive inside iframe


I have an iframe on a page that will display an image file I am hosting.
I can make the iframe responive so that it get's larger or smaller depending on window size but am looking to have the actual image in the iframe scale to fit the iframe as opposed to having the scroll bars appear when the iframe gets smaller than the image. Is there a way to do this?
Below is the code I am working with where http://example.net/picture.jpg is the hosted image.
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
var frm = ['gallery', 'info'];
var hrf = ['http://example.com/', 'http://example.net/picture.jpg'];
function setSource() {
for(i=0, l=frm.length; i<l; i++) {
document.querySelector('iframe[name="'+frm[i]+'"]').src = hrf[i];
}
}
</script>
</head>
<body>
<iframe src="" name="gallery"></iframe>
<iframe src="" name="info"></iframe>
<span onclick="javascript: setSource();">Click me</span>
</body>
</html>

Related Links

Are decimal pixels in css supported in multiple browsers? [duplicate]
Float Right Elements Are Rendered Higher than other elements
What is shadow root
How can I centre this text vertically in the span?
Checkbox beside label as table-cell
Bootstrap navbar: brand on left - login on right - collapsible menu on center
Nest div tag override parent div tags property
css problems in IE11
CSS make p tag not stretch div width
HTML Document with underlined fields for filling
Bootstrap, strange lag
How to show top-right part of an iframe/object content in a small frame?
Custom Font SVG on webpage
HTML - Divison over edge of screen [closed]
Bootstrap 3.3.6 Grid boundaries not providing a rigid structure
Parent div height 0, clearfix doesn't work

Categories

HOME
jira-rest-java-api
python-sphinx
maps
xslt
google-cloud-dataflow
native
transition
chisel
centos7
torrent
r.net
virtual-reality
typescript2.0
angular2-components
python-asyncio
xls
indexeddb
computational-geometry
github-pages
ssh-agent
android-volley
profiler
mcs
rpc
datomic
jdbctemplate
afnetworking
healpy
ibm-infosphere
tor
vega
passport
bounding-box
azure-automation
control
scrum
imagemagic
sketch-3
google-sitemap
terminator
dispatcher
dcm4che
traits
logmein
state-space
ultragrid
winjs
joomla3.4
geoxml3
smartsvn
gnulib
opencv-contour
variadic-macro
uiaccessibility
zurmocrm
chilkat
xterm
matter.js
android-immersive
quartus-ii
android-keypad
number-systems
ergoemacs
jsxgraph
matchmaking
typescript1.5
warehouse
alchemyapi
autobahnjs
python-social-auth
vs-community-edition
mirage
xcode7.2
programmatically-created
xuggler
erlangweb
barrage
reformat
emulate
django-fixtures
subform
jquery-mobile-checkbox
static-typing
android-inflate
jquery-hover
cmdlets
oracle-text
jquery-cookie
sketchflow
java-interop
aspect
gnu-toolchain
render-to-string
ilgenerator
drools-flow
tlv
declarative-programming
ssl-security

Resources

Mobile Apps Dev
Database Users
javascript
java
csharp
php
android
MS Developer
developer works
python
ios
c
html
jquery
RDBMS discuss
Cloud Virtualization
Database Dev&Adm
javascript
java
csharp
php
python
android
jquery
ruby
ios
html
Mobile App
Mobile App
Mobile App