Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Issue with using glidejs and knockout #647

Open
matthew-g-austin opened this issue Jan 20, 2023 · 0 comments
Open

Issue with using glidejs and knockout #647

matthew-g-austin opened this issue Jan 20, 2023 · 0 comments

Comments

@matthew-g-austin
Copy link

I'm using a knockout foreach to put in elements into the carousel. I'm thinking that glide.js is trying to remove my child nodes that are added after knockout has already removed them.
<!-- ko foreach: {data: cameraStreamerData, as: 'canvasInfo', afterAdd: updateCarousel} --> <!-- ko if: canvasInfo.enabled --> <li class="glide__slide" data-bind="attr: {id: 'glide-slide-' + $index()"> <camera-streamer params="canvasClass: 'primary', canvasIndex: $index, canvasInfo: canvasInfo" data-bind="width: canvasWidth() + 'px', height: canvasHeight() + 'px' " ></camera-streamer> <!-- <camera-streamer style="height: 1500px; width: 1500px" params="canvasClass: 'secondary', canvasIndex: $index, canvasInfo: canvasInfo"></camera-streamer><--> </li> <!-- /ko --> <!-- /ko -->

This could be fixed by adding the suggested change here:
`
/**
* Remove all cloned slides.
*
* @return {Void}
*/
remove: function remove() {
var items = this.items;

    for (var i = 0; i < items.length; i++) {
      if (Components.Html.wrapper.contains(items[i]))
      {
        Components.Html.wrapper.removeChild(items[i]);
      }
    }
  }
};

`

Please let me know if there is another workaround that I'm unaware of.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant