question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

transitionDuration in v4 not working

See original GitHub issue

I’ve migrated from v3 to v4 on my Svelte app and now, for some reason, transitionDuration stopped working i.e. doesn’t animate my grid anymore when I change screensize. Here’s my code on v4

<script>
  import { onMount } from 'svelte'
  import { MasonryInfiniteGrid } from '@egjs/svelte-infinitegrid'
  import Spinner from '../../components/ui/Spinner.svelte'
  import { stores } from '@sapper/app'
  import { toHSL, sleep } from 'utils'
  import tinycolor from 'tinycolor2'

  const { session } = stores()
  let mountedToDom = false

  let ig
  let loading
  let items = []

  const loadItems = (groupKey, nextKey, itemCount) => {
    const nextItems = []
    for (let i = 0; i < itemCount; ++i) {
      nextItems.push({ groupKey, key: nextKey + i })
    }
    return nextItems
  }

  const onAppend = async ({ detail: { groupKey, startLoading } }) => {
    // if (ig.isProcessing()) {
    //   return
    // }
    // startLoading()
    // await sleep(3000)
    const nextGroupKey = (parseFloat(groupKey) || 0) + 1
    const nextKey = items.length
    items = [...items, ...loadItems(nextGroupKey, nextKey, 10)]
  }

  const onLayoutComplete = ({ detail: { isLayout, endLoading } }) => { !isLayout && endLoading() }

  onMount(() => { mountedToDom = true })
</script>

{#if mountedToDom }
  <div class="my-6 md:my-10">
    <MasonryInfiniteGrid
      gap={10}
      align={"center"}
      isConstantSize={true}
      transitionDuration={0.7}

      {items}
      {loading}
      bind:this={ig}
      let:visibleItems

      groupBy={item => item.groupKey}
      itemBy={item => item.key}

      on:requestAppend={onAppend}
    >

      {#each visibleItems as item, index (item.key)}
          <div class="thumbnail">
            <img src={`https://naver.github.io/egjs-infinitegrid/assets/image/${(item.key % 59) + 1}.jpg`} alt="edm"/>
          </div>
      {/each}
    </MasonryInfiniteGrid>
  </div>
{/if}


<style>
  .item {
    width: 300px;
    opacity: 1;
    border-radius: 0.3rem;
    overflow: hidden;
    border-width: 4px;
  }
  .item .thumbnail {
    max-height: 300px;
    overflow: hidden;
  }
  .item .thumbnail img {
    width: 100%;
    /* border-radius: 0.2rem; */
  }
</style>

Any ideas why it stopped working? Also, in v3 I used options={{ isConstantSize: true, transitionDuration: 0.7 }} but figured that stopped working in v4 so I switched to using options such isConstantSize etc. as shown in the code above. Is that correct in v4?

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Comments:7 (4 by maintainers)

github_iconTop GitHub Comments

1reaction
daybrushcommented, Oct 6, 2021

@evdama

infinitegrid’s new version 4.1.0 is released. And support transition.

https://naver.github.io/egjs-infinitegrid/Guides#use-transition

1reaction
daybrushcommented, Sep 15, 2021

@evdama in v3

// common options
const ig = new eg.InfiniteGrid(".app", {
    isConstantSize: true,
    transitionDuration: 0.2,
});

// layoutOptions
ig.setLayout(eg.InfiniteGrid.GridLayout, {align: "center", margin: 3});
ig.layout(true);

<GridLayout
    options={...}
     layoutOptions={...} />

but in v4

const ig = new InfiniteGrid.MasonryInfiniteGrid(".app", {
    isConstantSize: true,
    align: "center",
    gap: 3,
});

ig.renderItems();

<MasonryInfiniteGrid
    isConstantSize={true}
    align={"center"}
    gap={3}
    />

Read more comments on GitHub >

github_iconTop Results From Across the Web

Transition duration not working on bootstrap button
I am trying to add transition effect on some bootstrap buttons. The problem is with height and width properties.
Read more >
transition-duration - CSS: Cascading Style Sheets | MDN
The transition-duration CSS property sets the length of time a transition animation should take to complete. By default, the value is 0s, ...
Read more >
Transition-duration NOT working??? (Example) - Treehouse
It was working for about 10 minutes, but then just stopped. I rebooted my computer twice, still nothing.is it just on my browser/computer??...
Read more >
Why is my transition-duration not working? : r/csshelp - Reddit
Hi, I am new to coding, taking classes on Coursera. I am learning CSS and as I was doing an assignment I wanted...
Read more >
Adjust transitions in the Final Cut Pro timeline - Apple Support
In Final Cut Pro, change a transition's duration, move it using a roll edit, or trim the left clip's end point or the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found