how can I make my FAB speed dial close when an y button is tapped?
to clarify: the fab closes when a speed dial button references a popup (class = ‘popup-open’) or another page (class=“link external”); but stays open when a speed dial button calls a JS function.
You can do this:
app.on('init', function() {
app.$(document).on('click', '.fab-close', function() {
const fab = app.$(this).parents('.fab');
if (fab.length) {
app.fab.close(fab);
}
});
});
Place the above code after Framework7 initialization, ie, after
var app = new Framework7({
});
Now in your HTML, put fab-close class to the speed-dial buttons.
For example:
<div class="fab fab-right-bottom">
<a href="#">
<i class="icon material-icons">add</i>
<i class="icon material-icons">close</i>
</a>
<div class="fab-buttons fab-buttons-right">
<a href="#" class="fab-label-button fab-close">
<span>1</span>
<span class="fab-label">Action 1</span>
</a>
<a href="#" class="fab-label-button fab-close">
<span>2</span>
<span class="fab-label">Action 2</span>
</a>
<a href="#" class="fab-label-button fab-close">
<span>3</span>
<span class="fab-label">Action 3</span>
</a>
</div>
</div>
Thanks - all now sorted