@aarongraston/classtoggle 中文文档教程
classtoggle
构造一个对象,该对象将切换您传递给它的构造函数的类。 适用于文档节点对象。
Install
$ npm install @aarongraston/classtoggle
Usage
import classToggle from '@aarongraston/classtoggle';
hideToggle = classToggle('class-name');
elementToHide = document.querySelector('#myElement');
elementToHide.addEventListener('click', hideToggle.toggle.bind(elementToHide));
classtoggle
construct an object that will toggle a class you pass to it's constructor. Works on document node objects.
Install
$ npm install @aarongraston/classtoggle
Usage
import classToggle from '@aarongraston/classtoggle';
hideToggle = classToggle('class-name');
elementToHide = document.querySelector('#myElement');
elementToHide.addEventListener('click', hideToggle.toggle.bind(elementToHide));