mirror of
https://github.com/wallabag/wallabag.git
synced 2025-06-27 16:36:00 +00:00
Extract Sticky Nav controller
This commit is contained in:
parent
2054be7bd4
commit
c9cfae11f7
4 changed files with 13 additions and 11 deletions
|
@ -22,6 +22,10 @@ export default class extends Controller {
|
|||
}
|
||||
}
|
||||
|
||||
click() {
|
||||
this.dispatch('click');
|
||||
}
|
||||
|
||||
disconnect() {
|
||||
this.instance.destroy();
|
||||
}
|
||||
|
|
7
assets/controllers/sticky_nav_controller.js
Normal file
7
assets/controllers/sticky_nav_controller.js
Normal file
|
@ -0,0 +1,7 @@
|
|||
import { Controller } from '@hotwired/stimulus';
|
||||
|
||||
export default class extends Controller {
|
||||
toggle() {
|
||||
this.element.classList.toggle('entry-nav-top--sticky');
|
||||
}
|
||||
}
|
|
@ -129,16 +129,7 @@ import './scss/index.scss';
|
|||
addDarkThemeListeners();
|
||||
}());
|
||||
|
||||
const stickyNav = () => {
|
||||
const nav = $('.js-entry-nav-top');
|
||||
$('[data-toggle="actions"]').click(() => {
|
||||
nav.toggleClass('entry-nav-top--sticky');
|
||||
});
|
||||
};
|
||||
|
||||
$(document).ready(() => {
|
||||
stickyNav();
|
||||
|
||||
$('#nav-btn-add-tag').on('click', () => {
|
||||
$('.nav-panel-add-tag').toggle();
|
||||
$('.nav-panel-menu').addClass('hidden');
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue