Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
79be316
commit b0a3e3a
Showing
6 changed files
with
57 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
## Getting Started | ||
|
||
### Install | ||
|
||
This package can be installed via NPM (`npm install iframe-resizer --save`). | ||
|
||
### Usage | ||
|
||
The package contains two minified JavaScript files in the [js](../js) folder. The first ([iframeResizer.min.js](https://raw.githubusercontent.com/davidjbradshaw/iframe-resizer/master/js/iframeResizer.min.js)) is for the page hosting the iFrames. It can be called with **native** JavaScript; | ||
|
||
```js | ||
var iframes = iFrameResize( [{options}], [css selector] || [iframe] ); | ||
``` | ||
|
||
or via **jQuery**. | ||
|
||
```js | ||
$('iframe').iFrameResize( [{options}] ); | ||
``` | ||
|
||
The second file ([iframeResizer.contentWindow.min.js](https://raw.github.com/davidjbradshaw/iframe-resizer/master/js/iframeResizer.contentWindow.min.js)) needs placing in the page(s) contained within your iFrame. <i>This file is designed to be a guest on someone else's system, so has no dependencies and won't do anything until it's activated by a message from the containing page</i>. | ||
|
||
### Typical setup | ||
|
||
The normal configuration is to have the iFrame resize when the browser window changes size or the content of the iFrame changes. To set this up you need to configure one of the dimensions of the iFrame to a percentage and tell the library to only update the other dimension. Normally you would set the width to 100% and have the height scale to fit the content. | ||
|
||
```html | ||
<style>iframe{width: 1px;min-width: 100%;}</style> | ||
<iframe id="myIframe" src="http://anotherdomain.com/iframe.html"></iframe> | ||
<script>iFrameResize({log:true}, '#myIframe')</script> | ||
``` | ||
|
||
**Note:** Using _min-width_ to set the width of the iFrame, works around an issue in iOS that can prevent the iFrame from sizing correctly. | ||
|
||
If you have problems, check the [troubleshooting](troubleshooting.md) section. | ||
|
||
### Example | ||
|
||
To see this working take a look at this [example](http://davidjbradshaw.com/iframe-resizer/example/) and watch the [console](https://developer.mozilla.org/en-US/docs/Tools/Web_Console). |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,14 @@ | ||
# iFrame-Resizer Documentation | ||
|
||
* [Getting Started](getting_started.md) | ||
* **Parent Page API** | ||
* [Options](parent_page/options.md) | ||
* [Events](parent_page/events.md) | ||
* [Methods](parent_page/methods.md) | ||
* **IFramed Page API** | ||
* [Options](iframed_page/options.md) | ||
* [Events](iframed_page/events.md) | ||
* [Methods](iframed_page/methods.md) | ||
* [Troubleshooting](troubleshooting.md) | ||
* [Upgrade from version 3](upgrade.md) | ||
* [Version history](../CHANGELOG.md) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
## Upgrading to version 4 | ||
|
||
In version 4 support for IE 8-10 and Andriod 4.4 has been removed, if you still need this then please use version 3 or this library. | ||
In version 4 support for IE 8-10 and Andriod 4.4 has been removed, if you still need this then please use version 3 of this library. | ||
|
||
The callback methods have been renamed to onEvents, so for example `scrollCallback` is now called `onScroll`. This is to enable better integration with modern libraries such as React. |