bbc/pym.js

Name: pym.js

Owner: BBC

Description: Resize an iframe responsively depending on the height of its content and the width of its container.

Forked from: nprapps/pym.js

Created: 2016-05-17 16:03:52.0

Updated: 2016-05-17 16:03:53.0

Pushed: 2018-02-16 16:50:24.0

Homepage: http://blog.apps.npr.org/pym.js/

Size: 747

Language: JavaScript

GitHub Committers

UserMost Recent Commit# Commits

Other Committers

UserEmailMost Recent Commit# Commits

README

Pym.js

About

Using iframes in a responsive page can be frustrating. It’s easy enough to make an iframe’s width span 100% of its container, but sizing its height is tricky — especially if the content of the iframe changes height depending on page width (for example, because of text wrapping or media queries) or events within the iframe.

Pym.js embeds and resizes an iframe responsively (width and height) within its parent container. It also bypasses the usual cross-domain issues.

Use case: The NPR Visuals team uses Pym.js to embed small custom bits of code (charts, maps, etc.) inside our CMS without CSS or JavaScript conflicts. See an example of this in action.

› Read the documentation
› Browse the API
Development tasks

Grunt configuration is included for running common development tasks.

Javascript can be linted with jshint:

t jshint

Unminified source can be regenerated with:

t concat

Minified source can be regenerated with:

t uglify

API documention can be generated with jsdoc:

t jsdoc

The release process is documented on the wiki.

License & Credits

Released under the MIT open source license. See LICENSE for details.

Pym.js was built by the NPR Visuals team, based on work by the NPR Tech Team and Ioseb Dzmanashvili. Thanks to Erik Hinton for suggesting the name.

Additional contributors:


This work is supported by the National Institutes of Health's National Center for Advancing Translational Sciences, Grant Number U24TR002306. This work is solely the responsibility of the creators and does not necessarily represent the official views of the National Institutes of Health.