-
Notifications
You must be signed in to change notification settings - Fork 23
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
Adding an expand button #62
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some nits here and there. Rest LGTM :D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks like a nice feature!
I'd only say that can you change the button text to "Collapse" by default, and when the group is hidden (collapsed), the button text becomes "Expand".
You can create a boolean which stores if the group is collapsed or not.
Will work on the changes and get back to you |
} else { | ||
content.style.maxHeight = content.scrollHeight + "px"; | ||
document.getElementById("expand").innerHTML = "⯅"; | ||
content.style.margin = 16 + "px"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can directly put content.style.margin = "16px";
here :)
if (content.style.maxHeight) { | ||
document.getElementById("expand").innerHTML = "⯆"; | ||
content.style.maxHeight = null; | ||
content.style.margin = 0; | ||
} else { | ||
content.style.maxHeight = content.scrollHeight + "px"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can you explain what you are trying to do here? I'm a bit confused about what's happening here 😅
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So basically i wanted to animate the collapse/expand effect but as it turns out
So i couldn't use the transition effect on it.
So i used maxHeight property as a substitute.
When maxHeight of the collapsible is null, it will expand and the value of maxHeight will be equal to the height of the content ie ScrollHeight .
When maxHeight of the collapsible is not null, it will collapse thus taking a value of zero/null.
and then i put this in the transition property that can be found in the css file.
Hope this clears your query.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
aah, got it. Good to know. Thanks :)
@DragoVeizen Found some bugs during testing.
@DragoVeizen Since you haven't touched anything from |
Oh okay..ill check it out :) |
Hey, @DragoVeizen any updates on this? |
No not really i was investing most of my time somewhere else ill get back to this in a day or two and hopefully make it right. |
cool, no problem, just checking :D |
fixes #45
Button still to be customised and placed accordingly