Get started with stretchy CDN

MIT licensed

A lightweight, flexible library adjusts HTML element size and position dynamically.

Tags:
  • element
  • autosizing
  • form

Stable version

Copied!

How to start using stretchy CDN


<!DOCTYPE html>
<html>
<head>
  <title>Get started with stretchy CDN - cdnhub.io</title>
  <link rel="stylesheet" href="styles.css">
  <script src="https://cdn.cdnhub.io/stretchy/2.0.1/stretchy.min.js"></script>
</head>
<body>
  <div id="container">
    <img id="image" src="image.jpg" alt="Stretchy Image">
  </div>
  <script>
    const container = document.getElementById('container');
    const image = document.getElementById('image');

    stretchy(container, {
      minWidth: 300,
      maxWidth: 900,
      scale: 1.5,
      direction: 'horizontal'
    });

    window.addEventListener('resize', () => {
      stretchy.update(container);
    });
  </script>
</body>
</html>
Copied!
Copied!

All versions