-
Notifications
You must be signed in to change notification settings - Fork 51
Error after opening drawer #40
Comments
Hi @melissanoelle, Thanks for reporting this issue! I'm wondering are the Is it possible for you to post a version of the HTML/DOM that you are trying to run Pikabu on? Also, right after you run the code to initialize Pikabu, if you check Cheers, |
Thanks for your response! I won't be able to respond to this until Monday though. Just thought I'd give you a heads up. |
You are correct with your guess that I am unsetting and then resetting a new I don't think it's possible for me to post access of what I'm working on anywhere online where you could reach it, unfortunately. Right after pikabu is initialized, |
Hey @melissanoelle, Would it be possible to replace the contents of the right sidebar without replacing the whole sidebar? That might get around this issue until we figure out a method for re-initialization. |
Unfortunately, it's not. The left panel does something like that, but I'm On Sat, Sep 27, 2014 at 1:53 PM, Kyle Peatt notifications@github.com
|
Did you need anything from me on this? |
@melissanoelle I don't think so. With the current implementation we don't have a way for you to re-create the Pikabu if elements that it relies upon are added or removed from the page. It works well if you are able to keep the structure of the page static but is lacking otherwise. I'm wondering if maybe the best course of action would be to delete/re-creating the Pikabu when your document structure changes. In future versions of Pikabu this use-case is something we want to be able to handle but at the moment I don't think we do a good job of it. |
I currently have pikabu configured and working great in a project locally. When the screen is resized smaller, I set up and enable pikabu, and when it becomes larger I undo all of that and display my UI normally for desktop view. This is working fine, except for that it doesn't return my UI back to normal desktop view after I pull a drawer out. I get this error in my console:
Uncaught TypeError: Cannot read property 'scrollHeight' of undefined
So, doing some digging, I found that it's looking for this:
https://github.com/mobify/pikabu/blob/master/src/pikabu.js#L516-L517
And that the sidebar is set here:
https://github.com/mobify/pikabu/blob/master/src/pikabu.js#L417
I found that when I accessed my pikabu object, that
pikabu.activeSidebar
containednull
. Fantastic! "I can solve this!" I thought. So I manually calledpikabu.openSidebar('left')
which worked, but I still got theCannot read properly 'scrollHeight' of undefined
error. I checkedpikabu.activeSidebar
to see what it held, and it was holdingleft
as expected. Hmn.So then I took a look at
pikabu.$sidebars
and found that it was indeed holding an object with left and right. I tried runningpikabu.$sidebars['left']
then, and got[]
. I then triedpikabu.$sidebars.left
and still got[]
.Any idea how to solve this? Is there something else I should be doing? This is how I am initing pikabu:
I have also set my
m-pikabu-sidebar m-pikabu-left
(andright
) classes, as well asm-pikabu-nav-toggle
anddata-role='left'
stuff on the toggle buttons.Any input/help/advice would be greatly appreciated. Thanks!
The text was updated successfully, but these errors were encountered: