Slick.js reload the slider on image asset change
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)
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...
@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.
@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.
Issue #2099
Changing asset via command
Hello All, I would like to emulate the assets manager image replace behavior. for example I created a view on the side with all the images...
Issue #1762
Image not change while we fetch html using editor.getHtml()
Hello @artf I am using grapes.js for my website-builder tool into my website. While i double click on any image the asset-manager will open...
Issue #541
Updatesrc on image change
I must be missing something, but when I change an image, the localstorage html isn't updating, however, changing the text does. So when I r...
Issue #3205
With buttons
https://grapesjs.com/demo.html when i edit the button text to 'test' after reload the result:
Paid Plugins That Match This Issue
Curated by issue keywords and label relevance to help you ship faster.
Loading paid plugin recommendations...
Check the open-source GrapesJS plugins on GitHub or run a quick search in our free catalog.
Browse free plugins β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.