Skip to content

Commit

Permalink
Add is-active to navbar trigger. Closes #36
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Erbe committed Jun 14, 2018
1 parent 9e96c21 commit b85be4d
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 8 deletions.
4 changes: 2 additions & 2 deletions dist/bulma.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/navbar.js
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ eval("__webpack_require__.r(__webpack_exports__);\nconst Bulma = {\n /**\n
/***/ (function(module, __webpack_exports__, __webpack_require__) {

"use strict";
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core */ \"./src/core.js\");\n\n\n/**\n * @module Navbar\n * @since 0.1.0\n * @author Thomas Erbe <vizuaalog@gmail.com>\n */\nclass Navbar {\n\n static getRootClass() {\n return 'navbar';\n }\n\n /**\n * Plugin constructor\n * @param {Object} options The options object for this plugin\n * @return {this} The newly created plugin instance\n */\n constructor(options) {\n if (!options.element || !options.trigger || !options.target) {\n throw new Error('[BulmaJS] The navbar component requires an element, trigger and target to function.');\n }\n\n /**\n * The root navbar element.\n * @type {HTMLElement}\n */\n this.root = options.element;\n\n /**\n * The element used for the trigger.\n * @type {HTMLElement}\n */\n this.trigger = options.trigger;\n\n /**\n * The target element.\n * @type {HTMLELement}\n */\n this.target = options.target;\n\n this.registerEvents();\n }\n\n /**\n * Register all the events this module needs.\n * @return {undefined}\n */\n registerEvents() {\n this.trigger.addEventListener('click', this.handleTriggerClick.bind(this));\n }\n\n /**\n * Handle the click event on the trigger.\n * @return {undefined}\n */\n handleTriggerClick() {\n if (this.target.classList.contains('is-active')) {\n this.target.classList.remove('is-active');\n } else {\n this.target.classList.add('is-active');\n }\n }\n\n /**\n * Handle parsing the DOMs data attribute API.\n * @param {HTMLElement} element The root element for this instance\n * @return {undefined}\n */\n static handleDomParsing(element) {\n new Navbar({\n element: element,\n trigger: element.querySelector('.navbar-burger'),\n target: element.querySelector('.navbar-menu')\n });\n }\n}\n\n_core__WEBPACK_IMPORTED_MODULE_0__[\"default\"].registerPlugin('navbar', Navbar);\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Navbar);\n\n//# sourceURL=webpack:///./src/plugins/navbar.js?");
eval("__webpack_require__.r(__webpack_exports__);\n/* harmony import */ var _core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../core */ \"./src/core.js\");\n\n\n/**\n * @module Navbar\n * @since 0.1.0\n * @author Thomas Erbe <vizuaalog@gmail.com>\n */\nclass Navbar {\n\n static getRootClass() {\n return 'navbar';\n }\n\n /**\n * Plugin constructor\n * @param {Object} options The options object for this plugin\n * @return {this} The newly created plugin instance\n */\n constructor(options) {\n if (!options.element || !options.trigger || !options.target) {\n throw new Error('[BulmaJS] The navbar component requires an element, trigger and target to function.');\n }\n\n /**\n * The root navbar element.\n * @type {HTMLElement}\n */\n this.root = options.element;\n\n /**\n * The element used for the trigger.\n * @type {HTMLElement}\n */\n this.trigger = options.trigger;\n\n /**\n * The target element.\n * @type {HTMLELement}\n */\n this.target = options.target;\n\n this.registerEvents();\n }\n\n /**\n * Register all the events this module needs.\n * @return {undefined}\n */\n registerEvents() {\n this.trigger.addEventListener('click', this.handleTriggerClick.bind(this));\n }\n\n /**\n * Handle the click event on the trigger.\n * @return {undefined}\n */\n handleTriggerClick() {\n if (this.target.classList.contains('is-active')) {\n this.target.classList.remove('is-active');\n this.trigger.classList.remove('is-active');\n } else {\n this.target.classList.add('is-active');\n this.trigger.classList.add('is-active');\n }\n }\n\n /**\n * Handle parsing the DOMs data attribute API.\n * @param {HTMLElement} element The root element for this instance\n * @return {undefined}\n */\n static handleDomParsing(element) {\n new Navbar({\n element: element,\n trigger: element.querySelector('.navbar-burger'),\n target: element.querySelector('.navbar-menu')\n });\n }\n}\n\n_core__WEBPACK_IMPORTED_MODULE_0__[\"default\"].registerPlugin('navbar', Navbar);\n\n/* harmony default export */ __webpack_exports__[\"default\"] = (Navbar);\n\n//# sourceURL=webpack:///./src/plugins/navbar.js?");

/***/ })

Expand Down
Loading

0 comments on commit b85be4d

Please # to comment.