Git Product home page Git Product logo

Comments (3)

Alhadis avatar Alhadis commented on June 15, 2024 1

👋 Hey @havardlj,

Not directly, I'm afraid. You can, however, set heightOffset manually in response to a window's resize event:

// Dummy code that illustrates `heightOffset` set
// to 5 on desktop and 2 for mobile devices.
window.addEventListener("resize", event => {
	accordion.heightOffset = window.innerWidth <= 600 ? 2 : 5;
});

It's possible that what you're trying to achieve can be done purely with CSS (padding, transparent borders, etc). Do you have a link to something that shows your accordion in action?

The heightOffset option is mainly intended to be a last resort for accordion styling that isn't easy to achieve using plain CSS (such as gaps between folds that already have borders). This is mainly because margin-bottom can't be used to insert empty space between folds... in hindsight, I should've added a useMargins option instead, which forces margins to be included when computing effective height.

from accordion.

havardlj avatar havardlj commented on June 15, 2024

Thanks for your quick feedback! I ended up changing the library to Handy Collapse however, as it lets me set the control/trigger-box and content-box, which solved several of my projects coding challenges.

from accordion.

Alhadis avatar Alhadis commented on June 15, 2024

What do you mean by "control/trigger box" and "content box"?

I designed this component to be as efficient as possible in terms of filesize (at the risk of alienating users less experienced with CSS and DOM interaction). Ergo, I understand if it doesn't align with everybody's expectations...

from accordion.

Related Issues (19)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.