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

Is it possible to change the image of the pin it button
Get data of specific cell in HTML Table using Selenium Webdriver with Python
Override CSS Classes Infinitely
Vertical spacing textboxes with Bootstrap form-horizontal
Vertical line with text around
Bootstrap dropdown styles weird on dropdown
translatex with transition not work smooth in RTL mode
Using Accelerated Mobile Pages with Bootstrap
Robohelp: How to reference a .chm file rather than copy it into a merged project?
How do you print every match of a RegEx to a different file?
Inserting select box in the CKEditor Text Area
Append additional HTML result in calling MVC action by Ajax in DNN8
Is there any relationship between swt components and html components
Show each product in aside while hover
ck-editor changes html codes of non-ascii characters to actual characters
Having trouble aligning my table header (two items in a column are overlapping)

Categories

HOME
linux
osx
vscode
google-api
icons
qgis
browser
crashlytics
io
hibernate-envers
rss
random
magento-1.7
nightwatch.js
2sxc
glm
thymeleaf
codemirror
mpeg-2
azure-web-app-service
excel-addins
wikidata
angular-ui-router
dbpedia
livesearch
scheduling
pyarango
django-forms
overlay
glob
exec
spring-el
railsapps
xdp
datatables-1.10
frame-rate
filesaver.js
angular-ui-tabset
hello.js
compute-shader
baseline
bingbot
libmemcache
jarsigner
htmlunit
xlrd
crosstool-ng
motionevent
linq-expressions
restlet-2.0
installshield-2015
infinidb
google-geolocation
computation
bit-fields
droidparts
secure-random
dvd
numa
starcounter
typescript1.5
hazard
facebook-insights
yeogurt
sdp
qlistview
crashlytics-android
playframework-2.4
xcode7.2
merchant-account
cutycapt
seconds
featured
jquery-deferred
visual-studio-sdk
fann
photo-tagging
joomla-k2
numerical-stability
oracle-commerce
sbatch
wcf-lob-adapter
sql-server-2005-express
array-multisort
xming
beaker
flash-cs3
horn
nested-sortable
particle-filter
boilerpipe
red-gate-ants
row-value-expression
executors
file-in-use
entityspaces
sites
django-syncdb
twofish
selectlist
java-interop
gritter
seam-carving
terminal-services-gateway
sandy3d
collective-intelligence
freeware

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