Why the smooth scrollbar wrapper breaks when new dynamic data is added within the wrapper? #335
Replies: 11 comments
-
@toxifiedmatrix you are using Alpine js? It's all about smooth-scroll API
|
Beta Was this translation helpful? Give feedback.
-
@sadeghbarati Hey, thanks for reverting back! Yes, I'm using Alpine JS, Tailwind CSS with Livewire stack. I have so many questions in my mind, on how this works.
|
Beta Was this translation helpful? Give feedback.
-
SmoothScroll update runs on resize so if u add content to a wrapper without resizing you have to update it manually It's a scroll plugin, not a native scroll your modal removes from dom when it's hidden? It's better to use smooth-scroll once on a wrapper for the whole body, not for modals u know the performance on mobile it gets laggy Alpine api is clear use
on external Component Logic or inline |
Beta Was this translation helpful? Give feedback.
-
No the modal is just hidden, it is displayed when the modal is toggled and is hidden on vice versa. I am pushing all the modals to the |
Beta Was this translation helpful? Give feedback.
-
Okay I see, I just need to figure out for once, how it is done, after that, I'll test it for mobile as well. Here is my modal component, how should I exactly format it, sorry for being a noob. Please help me out with this.
|
Beta Was this translation helpful? Give feedback.
-
@sadeghbarati Are you there? Help will be really appreciated. When I am using
|
Beta Was this translation helpful? Give feedback.
-
Like variable declare window variable in a parent javascript file that all page can access to this script then: window.scrollbarInstance = null
scrollbarInstance = Scrollbar.init('element', {
options...
})
scrollbarInstance.update() |
Beta Was this translation helpful? Give feedback.
-
@sadeghbarati Hey, thanks for the revert! This is how I'm doing it. As the content of the modal is present in the
|
Beta Was this translation helpful? Give feedback.
-
One more thing I don't understand is that, why the scroll jumps whenever I close the modal and behaves oddly whenever I open the modal? As the modal is in the hidden state, when the modal closes. |
Beta Was this translation helpful? Give feedback.
-
If you share a live site that would be better to collaborate surge - vercel - or laravel stuff - or simple server to push this site to it
|
Beta Was this translation helpful? Give feedback.
-
Ohh okay, I see, thanks mate, cant I upload it as a repository? |
Beta Was this translation helpful? Give feedback.
-
Environment
Issue Summary
I am using smooth-scrollbar in Laravel 8 with Livewire. I am using the scrollbar wrapper in a modal, the modal has dynamic data, as it fetches the data from the database. As I load the page, the scrollbar on the modal works just fine, but as soon as I add a new entry and try to open the modal to view the entry, the scrollbar wrapper seems broken, and it only works back as I reload the page. After I reload the the page, the modal component with the scrollbar just works fine and it also displays the updated data as well. Why such sort of thing is happening? Please help me out with this.
Steps to Reproduce
As you can see below, I have wrapped the scrollable content of the modal within the
content-wrapper
i.e. the smooth scrollbar.Beta Was this translation helpful? Give feedback.
All reactions