ctrl-freaks / freezeframe.js

freezeframe.js is a library that pauses animated .gifs and enables them to animate on mouse hover / mouse click / touch event, or with trigger / release functions.
http://ctrl-freaks.github.io/freezeframe.js/
MIT License
1.41k stars 111 forks source link

GIFS resize to be huge #157

Open Bracelet-Five opened 9 months ago

Bracelet-Five commented 9 months ago

I'm not sure if I'm implementing something incorrectly, but the gifs don't pause or start with a button and instead resize to be the width of the whole screen. Any idea what would cause this?

blankstaticscreen commented 9 months ago

this is also happening to me, although i got the gif buttons to work. but yeah the gif is huge. if you put it inside a div with a set width it'll resize to that width, but i'd like it to just show the image at the image's own dimensions.

here's how the buttons worked for me


<html lang="en">
  <head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>webbed site</title>
    <link rel="stylesheet" href="/style.css">
    <script src="https://unpkg.com/freezeframe/dist/freezeframe.min.js"></script>

  </head>

<body>

<button class="start">start</button>
<button class="stop">stop</button>

<img class="my-class-3 imgPixel" style="width:100%;height:auto;" src="https://i.postimg.cc/Rh48cVtP/dancecat-fixed.gif">

<script>
const manual = new Freezeframe('.my-class-3', {
  trigger: false
});

document
  .querySelector('.start')
  .addEventListener('click', () => {
    manual.start();
  });

document
  .querySelector('.stop')
  .addEventListener('click', () => {
    manual.stop();
  });
</script>

<script>new Freezeframe();</script>
</body>
</html>