Not logged in.  Login/Logout/Register | List snippets | | Create snippet | Upload image | Upload data

2
LINES

< > BotCompany Repo | #1029896 // https://raw.githubusercontent.com/thednp/navbar.js/master/dist/js/navbar.min.js

Document

// Navbar.js v2.1.0 | thednp © 2020 | MIT-License
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=e||self).Navbar=t()}(this,(function(){"use strict";var e="onmouseleave"in document?["mouseenter","mouseleave"]:["mouseover","mouseout"],t="webkitTransition"in document.head.style||"transition"in document.head.style,n="webkitTransition"in document.head.style?"webkitTransitionDuration":"transitionDuration",i="webkitTransition"in document.body.style?"webkitTransitionProperty":"transitionProperty";function o(e){var o=getComputedStyle(e),s=o[i],a=t&&s&&"none"!==s?parseFloat(o[n]):0;return isNaN(a)?0:1e3*a}function s(t,n){n=n||{};var i,s,a,r,u,l,m,c,d,p,f,v,g,b,y,N,L,E,h=function(e,t){e.classList.contains("open")&&(e.classList.remove("open"),t?setTimeout((function(){e.classList.remove("open-position"),e.isOpen=0}),l):(e.classList.remove("open-position"),e.isOpen=0)),e.classList.contains("open-mobile")&&e.classList.remove("open-mobile")},T=function(){return r&&"none"!==getComputedStyle(r).display||window.innerWidth<g},k=function(t){t=t?"addEventListener":"removeEventListener",Array.from(s).map((function(n){n.lastElementChild.classList.contains("subnav")&&(n[t](e[0],w),n[t](e[1],A),n[t]("focusin",w),n[t]("focusout",A));var i=n.getElementsByClassName("parent-toggle")[0];i&&i[t]("click",C)})),a&&a[t]("click",C)},C=function(e){e.preventDefault();var t,n;(e.target===this||this.contains(e.target))&&((n=this.closest("li")||this.closest(".navbar")).classList.contains("open-mobile")?n.classList.remove("open-mobile"):(n.classList.add("open-mobile"),t=b?n.parentNode.getElementsByTagName("LI"):n.getElementsByTagName("LI"),Array.from(t).map((function(e){return e!==n&&h(e)}))))},w=function(){var e=this;clearTimeout(e.timer),e.isOpen||T()||(e.timer=setTimeout((function(){e.classList.add("open-position"),e.classList.add("open"),e.isOpen=1,Array.from(e.parentNode.getElementsByTagName("LI")).map((function(t){return t!==e&&h(t)}))}),17))},A=function(){var e=this;e.isOpen&&!T()&&(clearTimeout(e.timer),e.timer=setTimeout((function(){return h(e,1)}),y))};this.dispose=function(){k(),delete i.Navbar},N=t,E=L&&L instanceof Element?L:document,(i=N instanceof Element?N:E.querySelector(N)).Navbar&&i.Navbar.dispose(),s=i.getElementsByTagName("LI"),a=i.getElementsByClassName("navbar-toggle")[0],r=i.getElementsByClassName("parent-toggle")[0],u=i.getElementsByClassName("subnav")[0],l=u?o(u):0,m=n.breakpoint,c=n.toggleSiblings,d=n.delay,p=i.getAttribute("data-breakpoint"),f=i.getAttribute("data-toggle-siblings"),v=i.getAttribute("data-delay"),g=isNaN(m)?p&&!isNaN(p)?parseInt(p):768:m,b=c||(f&&"true"===f?1:0),y=isNaN(d)?v&&!isNaN(v)?parseInt(v):500:d,k(1),i.Navbar=this}function a(e){e=e||document,Array.from(e.querySelectorAll('[data-function="navbar"]')).map((function(e){return new s(e)}))}return document.body?a():document.addEventListener("DOMContentLoaded",(function e(){a(),document.removeEventListener("DOMContentLoaded",e)})),s}));

download  show line numbers   

Travelled to 5 computer(s): bhatertpkbcr, mqqgnosmbjvj, pyentgdyhuwx, tvejysmllsmz, vouqrxazstgt

No comments. add comment

Snippet ID: #1029896
Snippet name: https://raw.githubusercontent.com/thednp/navbar.js/master/dist/js/navbar.min.js
Eternal ID of this version: #1029896/1
Text MD5: 631d78f83d62a652786e46101d067a12
Author: stefan
Category:
Type: Document
Public (visible to everyone): Yes
Archived (hidden from active list): No
Created/modified: 2020-09-28 16:47:45
Source code size: 3035 bytes / 2 lines
Pitched / IR pitched: No / No
Views / Downloads: 100 / 49
Referenced in: [show references]