• This repository has been archived on 28/Oct/2020
  • Stars
    star
    1,598
  • Rank 29,101 (Top 0.6 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created about 8 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

🖼 Reframe unresponsive elements responsively.

⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️

This software is maintained under a new repository located at yowainwright/reframe.js

⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️⚠️


Reframe.js, reframe your content responsively

npm version 0.3.6 unpkg Greenkeeper Build Status Share


🖼 Reframe.js

Reframe.js is a javascript plugin that makes elements scale at a fixed ratio.

This is particularly awesome for making embedded stuff, like videos or playlists, scale appropriately within a content area. This can done by hand but it's difficult to maintain, especially with CMS's and multiple editors. Reframe.js solves this issue—perfectly!

Alternatively, noframe.js is provided. Noframe.js scales selected elements at a fixed ratio but does not manipulate the dom's element structure at all! This keeps things like analytic events that run on embedded content intact!

Installing

NPM

npm i reframe.js --save

Yarn

yarn add reframe.js

Setup

  1. Add dist/reframe.js
  2. reframe the element you'd like to re-frame.

Examples

reframe('iframe'); // Wrap all iFrames in the page
reframe(document.getElementById('my-frame')); // Pass a DOM element
reframe(document.querySelectorAll('.my-targets')) // Pass a live node list

Elements that have been wrapped with reframe will not be wrapped twice.

How?

Reframe.js wraps a specified element in a div that is an intrinsic ratio of the original element. This plugin is great for embedded content like iframes or videos.

Why Reframe.js?

Reframe.js is inspired by FitVids and does what FitVids does but without the need for jQuery. This makes the plugin highly valuable when including it in a module that has to be very small and with minimal dependencies. Here's a basic codepen example.

This plugin is small - ~1.3kb unminified and is meant to do 1 thing - wrap elements that aren't responsive and make them responsive. 💪

Options

If you'd like to not use the classname 'js-reframe', just use your own.

reframe('iframe', 'my-classname');

jQuery

Reframe.js works with jQuery or Zepto. As of version 2.0.0, use jquery.reframe.js for jQuery or Zepto.

$('iframe').reframe();

// While using a custom class name
$('iframe').reframe('my-classname');

🌐 Noframe.js

Noframe.js makes the same ratio as Reframe.js using css calc.

Noframe.js's doesn't wrap the element you'd like to be responsive. It, instead, does a calculation based on its or a parent element's max-width. Here's a basic codepen example.

Noframe.js Notes

  • The reframed element requires a parent element with a max width to scale above the selected elements intial size otherwise the reframed element will only scale below its initial size. 👍

Setup

  1. Add dist/noframe.js
  2. noframe the element you'd like to re-frame.

Examples

noframe('iframe');
noframe('iframe', 'parent');

jQuery

Noframe.js works with jQuery or Zepto. As of version 2.0.0, use jquery.noframe.js for jQuery or Zepto.

$('iframe').noframe();
$('iframe').noframe('parent');

Reframe.js or Noframe.js?

Reframe.js offers the simplest solution to making elements scale at an intrinsic ratio.

Noframe.js doesn't wrap the selected element to make it scale at an intrinsic ratio. Noframe.js is the ideal solution when various events, like tracking events, could be affected when an element is wrapped. It does require a width or max-width which can involve a bit more setup awareness.


Created and maintained by Jeff Wainwright with Dollar Shave Club Engineering.

More Repositories

1

stickybits

Stickybits is a lightweight alternative to `position: sticky` polyfills 🍬
JavaScript
2,188
star
2

shave

💈 Shave is a 0 dep JS plugin that truncates text to fit within an element based on a set max-height ✁
JavaScript
2,110
star
3

postmate

📭 A powerful, simple, promise-based postMessage library.
JavaScript
1,842
star
4

scrolldir

0 dependency JS plugin to leverage scroll direction with CSS ⬆⬇ 🔌💉
JavaScript
663
star
5

cloudworker

Run Cloudflare Worker scripts locally
JavaScript
518
star
6

es-check

Checks the version of ES in JavaScript files with simple shell commands 🏆
JavaScript
460
star
7

ImageButter

Makes dealing with images buttery smooth.
C
394
star
8

furan

Scale out Docker builds
Go
344
star
9

study

A simple, progressive, client/server AB testing library 📚
JavaScript
312
star
10

polymerase

A tool for populating templates with environment variables and Vault values
Go
85
star
11

react-passage

Link and Redirect to routes safely in your react applications 🌄
JavaScript
58
star
12

package-diff

Diffs the packages used between two node_modules folders
JavaScript
57
star
13

ex_cluster

Clustered Elixir OTP application on Kubernetes with Horde and LibCluster
Elixir
52
star
14

ember-responds-to

Simple mixins for browser event handling.
JavaScript
41
star
15

fastboot-docker

[DEPRECATED] Ember FastBoot App Server in a box.
JavaScript
34
star
16

e2e

Make End-to-End Testing Great For Once
JavaScript
32
star
17

line

An easy to use golang package for stylizing terminal output
Go
27
star
18

ember-route-layers

Wire up your cancel buttons in easy mode.
JavaScript
26
star
19

ember-uni-form

Powerful forms without the confusion.
JavaScript
23
star
20

dynamo-drift

Go
23
star
21

terraform-provider-nrs

A Terraform provider for New Relic Synthetics
Go
22
star
22

monitor

A remote uptime monitoring framework for running monitors as a CRON job
JavaScript
21
star
23

vault-dev-docker

Vault docker image for local development
Shell
16
star
24

s3-uploader

Concurrent streaming upload to Amazon S3
Go
16
star
25

guardian

Go
13
star
26

ember-cli-anybar

A non-intrusive build notification system built atop AnyBar.
JavaScript
12
star
27

golang-protobuf-base-docker

Shell
9
star
28

psst

A secret sharing tool
Go
9
star
29

runtype

Runtype converts Typescript type aliases, interfaces, and enums to Javascript that can be used during runtime
JavaScript
9
star
30

vaultenvporter-go

A tool for turning a set of Vault secrets into environment variables
Go
8
star
31

talcum

Talcum allows members of a distributed system to auto-configure themselves 👥
Go
8
star
32

harmless-changes

Ignore unnecessary build steps if changes are harmless to make builds faster 🏎 💨
Shell
7
star
33

node-auto-repair-operator

A Kubernetes operator that can repair problematic nodes (under development)
Go
6
star
34

eslint-config-dollarshaveclub

Base eslint configs for Dollar Shave Club.
JavaScript
5
star
35

dependents

Shows package dependency versions in specified repositories
JavaScript
5
star
36

new-relic-synthetics-go

A New Relic Synthetics API client for Go
Go
5
star
37

pvc

Applications secrets access library
Go
4
star
38

Swift-WebP

Easy WebP usage in your iOS app!
C
4
star
39

ember-link-after-build

Symlink a folder in lieu of copying files for faster build times
JavaScript
4
star
40

fastboot-cluster-node-cache

A FastBoot app server cache built atop cluster-node-cache
JavaScript
3
star
41

jobmanager

Go
3
star
42

crudite

Go
3
star
43

go-productionize

A set of libraries that will help Go services be more production ready
Go
3
star
44

thermite

Removes old Amazon Elastic Container Registry images that are not deployed in a Kubernetes cluster
Go
2
star
45

go-lib

Go
2
star
46

sysctl-write-docker

Go
2
star
47

ember-shave

A simple wrapper over DSC's super fast and simple text truncation library called shave.
JavaScript
2
star
48

redis-resp

Go
2
star
49

ember-qualtrics

Ember Qualtrics Site Intercept addon.
JavaScript
1
star
50

eslint-plugin-dollarshaveclub

Linting code to shave the world.
JavaScript
1
star
51

ember-preapp-adapter

Request a payload before your Ember app has loaded.
JavaScript
1
star
52

go-for-newbs

Sample applications for people learning Go
Go
1
star
53

vault-shared-users

Vault Shared Users for securely allowing access to robot accounts across the organization
Go
1
star