dotsunited-off-canvas-navigation
Advanced tools
Comparing version 2.0.1 to 2.1.0
@@ -1,23 +0,33 @@ | ||
var $ = require('jquery'); | ||
(function(window, factory) { | ||
if (typeof define === 'function' && define.amd) { | ||
define(['jquery'], function($) { | ||
return factory(window, $); | ||
}); | ||
} else if (typeof module === 'object' && typeof module.exports === 'object') { | ||
module.exports = factory(window, require('jquery')); | ||
} else { | ||
window.dotsunitedOffCanvasNavigation = factory(window, window.jQuery || window.Zepto); | ||
} | ||
}(typeof window !== 'undefined' ? window : this, function(window, $) { | ||
return function(namespace) { | ||
var toggleSelector = '[data-' + namespace + '-toggle]'; | ||
var openClass = namespace + '--open'; | ||
module.exports = function(namespace) { | ||
var toggleSelector = '[data-' + namespace + '-toggle]'; | ||
var openClass = namespace + '--open'; | ||
var root = $('html').addClass(namespace); | ||
var root = $('html').addClass(namespace); | ||
$(window.document) | ||
.on('click.' + namespace, toggleSelector, function(e) { | ||
e.preventDefault(); | ||
$(document) | ||
.on('click.' + namespace, toggleSelector, function(e) { | ||
e.preventDefault(); | ||
var expanded = root | ||
.toggleClass(openClass) | ||
.hasClass(openClass) | ||
; | ||
var expanded = root | ||
.toggleClass(openClass) | ||
.hasClass(openClass) | ||
; | ||
$(toggleSelector) | ||
.attr('aria-expanded', (expanded ? 'true' : 'false')) | ||
.trigger(namespace + ':' + (expanded ? 'open' : 'close'), [this]); | ||
}) | ||
; | ||
}; | ||
$(toggleSelector) | ||
.attr('aria-expanded', (expanded ? 'true' : 'false')) | ||
.trigger(namespace + ':' + (expanded ? 'open' : 'close'), [this]); | ||
}) | ||
; | ||
}; | ||
})); |
@@ -7,5 +7,6 @@ { | ||
"name": "Jan Sorgalla", | ||
"url": "jan.sorgalla@dotsunited.de" | ||
"email": "jan.sorgalla@dotsunited.de", | ||
"url" : "https://dotsunited.de" | ||
}, | ||
"version": "2.0.1", | ||
"version": "2.1.0", | ||
"repository": { | ||
@@ -12,0 +13,0 @@ "type": "git", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
40
9324
7