Git Product home page Git Product logo

seamless-iframe's Introduction

Seamless Iframe

A fallback that emulates the main features of the seamless iframe.

How it works

"The browser should render the frame in a way that makes it appear to be part of the containing document."

Source: https://developer.mozilla.org/en-US/docs/Web/HTML/Element/iframe#Attributes

Demo

See it in action

Features

Seamless Iframe will:

  • open any anchor in the parent, unless you specify otherwise,
  • inherit the CSS declarations from the parent,
  • behave as block element, adjusting its size to its content.

Change log

See history.md

How to use (parent document)

CSS

Link to /dist/seamless-parent.css file:

<link rel="stylesheet" href="/dist/seamless-parent.css"/>

or include its declaration in your CSS:

iframe[seamless] {
    background-color: transparent;
    border: none;
    overflow: hidden;
    padding: 0;
    margin: 0;
}

JavaScript

Link to /dist/seamless-parent.js file:

<script src="/dist/seamless-parent.js"></script>

HTML

Include the seamless attribute (boolean) to your iframes as defined by W3C.

<iframe src="..." seamless></iframe>

How to use (into the iframe)

CSS

Link to /dist/seamless-iframe.css file:

<link rel="stylesheet" href="/dist/seamless-iframe.css"/>

or include its declaration in your CSS:

html {
    width: intrinsic; /* Safari/WebKit uses a non-standard name */
    width: -webkit-max-content;
    width: -moz-max-content; /* Firefox/Gecko */
    width: max-content;
    width: fit-content;
}

JavaScript

Link to /dist/seamless-iframe.js file:

<script src="/dist/seamless-iframe.js"></script>

TO-DO

  • Support IE.
  • Continue event bubbling from iframe to the parent document.
  • Expose a method that allow to suscribe to the iframe messages to extend the functionality.
  • Also see the issue tracker.

Support

  • Tested in most of mayor browsers.

seamless-iframe's People

Contributors

lean8086 avatar

Stargazers

martin. avatar

Watchers

martin. avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.