Issue #2650πŸ’¬ AnsweredOpened Mar 14, 2020by abzal02 reactions

Slick.js reload the slider on image asset change

Quick answerby pouyamiralayi❀ 1

Hi @abzal0 the correct function is actually `updateScript my bad! here is how i did it: first defining the component type: Every time the script runs, i reset the slickjs for the sake of re initialization which you can see in the script. I have also used image type directly as my component's children so i don't have t...

Read full answer below ↓

Question

Hello everyone, I am integrating slick slider, the issue is with reloading the slider after image is uploaded. After onclick of open assets the Slick slider must be reinitialized so that regular html of the slider would become slick slider, that happens on adding the component to the canvas only: $('#slickslider').slick({ dots: true, infinite: true, speed: 300, arrows:true, adaptiveHeight: true }); That works in two cases: When i add new slider to canvas When i upload new image and then drag and move the component it reinitializes The code: editor.DomComponents.addType('slickslider', { model:...

Answers (3)

pouyamiralayiβ€’ Mar 18, 2020

Hi @abzal0 the correct function is actually `updateScript my bad! here is how i did it: first defining the component type: Every time the script runs, i reset the slickjs for the sake of re initialization which you can see in the script. I have also used image type directly as my component's childr...

abzal0β€’ Mar 18, 2020

@pouyamiralayi this is incredibly valuable code, thanks a lot for sharing it :) it works better than I needed. Will be sending you an email, hopefully you will reply.

pouyamiralayiβ€’ Mar 14, 2020

@abzal0 how to reinitialize 'script' function inside editor.blockmanager.add to reload the jquery code of slider? for your `script` code, i suggest you move it to the component definition and in there, you can issue: for script reloads. Cheers!

Related Questions and Answers

Continue research with similar issue discussions.

Paid Plugins That Match This Issue

Curated by issue keywords and label relevance to help you ship faster.

View all plugins

Loading paid plugin recommendations...

Free option

Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.

Browse free plugins β†’
Premium option

Premium plugins ship with support, regular updates, and production-ready features β€” save days of integration work.

Browse premium plugins β†’

Browse Plugin Categories

Jump directly to plugin category pages on the marketplace.