Comments (2)
Use event.stopImmediatePropagation()
to prevent click
events on buttons from bubbling up to their parent elements. So, assuming the following markup:
<li>
<h3>
Foo
<button>Bar</button>
</h3>
<div class="fold">
…
</div>
</li>
… your code might look like this:
for(const el of document.querySelectorAll("button"))
el.addEventListener("click", event => {
event.stopImmediatePropagation();
// Handle any other button behaviour here
});
from accordion.
Thanks. This works.
from accordion.
Related Issues (19)
- Rewrite code in ECMAScript 6 HOT 2
- Update height if contents change HOT 6
- Enter and spacebar to open/close accordion item HOT 22
- README - bundled demos link broken HOT 1
- Where is demo? HOT 5
- Loaded event? HOT 23
- Deep linking HOT 6
- No easy way to add/remove folds after construction HOT 3
- Responsive heightOffset HOT 3
- Height not updating when closing an accordion nested in another
- Feature: Only open one accordion at a time, collapse others? HOT 3
- Incorrect heights set for nested accordions with pre-opened folds
- Borders aren't considered when calculating fold heights HOT 1
- To-do list
- Option to allow only one fold to be open at a time HOT 3
- Strange type rendering issue with Chrome 55 / Mac 10.10.5 HOT 14
- Doesn't work on IE HOT 11
- Great Plugin HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from accordion.