
Security News
NIST Under Federal Audit for NVD Processing Backlog and Delays
As vulnerability data bottlenecks grow, the federal government is formally investigating NIST’s handling of the National Vulnerability Database.
@threespot/fluid-iframe
Advanced tools
Allows iframes to scale down while maintaining its original aspect ratio. This is most useful for iframes authors paste into a rich-text WYSIWYG field. Managed iframes whose markup can be controlled directly (e.g. shortcodes) can achieve this with just HTML and CSS.
Inspired by FitVids.js and noframe.js.
yarn add @threespot/fluid-iframe
import FluidIframe from "@threespot/fluid-iframe";
const iframes = document.querySelectorAll("iframe");
iframes.forEach(el => new FluidIframe(el));
// Using a class instead of inline styles
iframes.forEach(el => new FluidIframe(el, {
inlineStyles: false,
classes: "video-wide"
}));
// Adding styles directly to the iframe with no wrapper
// (mean iframe won’t be able to expand beyond its original size)
iframes.forEach(el => new FluidIframe(el, { wrap: false }));
Here’s an example of how to use CSS instead of inline styles (requires wrapper around iframe):
// wrapper div around the iframe
.video-wide {
position: relative;
&:before {
content: '';
display: block;
padding-top: percentage(9/16);
}
iframe {
height: 100%;
left: 0;
position: absolute;
top: 0;
width: 100%;
}
}
These options can also be set in JavaScript:
new FluidFrame(el, {
defaultAspectRatio: 9 / 16,
forceRatio: false,// set aspect ratio to use regardless of actual dimensions of iframe
inlineStyles: true,// apply inline styles to wrapper or iframe (depends on wrap option)
wrap: true,// adds a div wrapper around the iframe
classes: "" // class(es) to add to the wrapper or iframe (depends on wrap option)
});
This is free software and may be redistributed under the terms of the MIT license.
Threespot is an independent digital agency hell-bent on helping those, and only those, who are committed to helping others. Find out more at https://www.threespot.com.
FAQs
Make iframes responsive
The npm package @threespot/fluid-iframe receives a total of 6 weekly downloads. As such, @threespot/fluid-iframe popularity was classified as not popular.
We found that @threespot/fluid-iframe demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 2 open source maintainers collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
As vulnerability data bottlenecks grow, the federal government is formally investigating NIST’s handling of the National Vulnerability Database.
Research
Security News
Socket’s Threat Research Team has uncovered 60 npm packages using post-install scripts to silently exfiltrate hostnames, IP addresses, DNS servers, and user directories to a Discord-controlled endpoint.
Security News
TypeScript Native Previews offers a 10x faster Go-based compiler, now available on npm for public testing with early editor and language support.