ay-accordion
Advanced tools
Comparing version 1.2.1 to 1.2.2
@@ -155,2 +155,8 @@ /*! Copyright (c) 2016 Ayogo Health Inc. | ||
self.root.style.minHeight = null; | ||
var scrollingRoot = document['scrollingElement'] || document.body; | ||
var pageBottom = scrollingRoot.scrollTop + scrollingRoot.clientHeight; | ||
var lastChild = measurements.pop(); | ||
if (lastChild.initialDimensions.height !== lastChild.newDimensions.height && (pageBottom - lastChild.initialDimensions.bottom < lastChild.initialDimensions.height)) { | ||
window.scrollBy(0, (lastChild.newDimensions.height - lastChild.initialDimensions.height)); | ||
} | ||
/* Invoke our callback function when done */ | ||
@@ -180,5 +186,5 @@ $scope.$applyAsync(function () { | ||
$element[0].setAttribute('open', ''); | ||
if ($element[0] === $element[0].parentNode.lastElementChild) { | ||
$element[0].scrollIntoView(); | ||
} | ||
Array.prototype.forEach.call($element.children(), function (el) { | ||
el.removeAttribute('hidden'); | ||
}); | ||
self.isOpen = true; | ||
@@ -208,13 +214,2 @@ $scope.$applyAsync(); | ||
} | ||
Array.prototype.forEach.call($element.children(), function (el) { | ||
if (el.hasAttribute('ay-accordion-header') || el.querySelector('[ay-accordion-header]')) { | ||
return; | ||
} | ||
if (self.isOpen) { | ||
el.removeAttribute('hidden'); | ||
} | ||
else { | ||
el.setAttribute('hidden', ''); | ||
} | ||
}); | ||
}; | ||
@@ -225,3 +220,11 @@ self.toggle = function (cb) { | ||
} | ||
self.rootCtrl.run(self.fn, cb); | ||
self.rootCtrl.run(self.fn, function () { | ||
Array.prototype.forEach.call($element.children(), function (el) { | ||
if (self.isOpen || el.hasAttribute('ay-accordion-header') || el.querySelector('[ay-accordion-header]')) { | ||
return; | ||
} | ||
el.setAttribute('hidden', ''); | ||
}); | ||
cb(); | ||
}); | ||
}; | ||
@@ -228,0 +231,0 @@ }], |
{ | ||
"name": "ay-accordion", | ||
"version": "1.2.1", | ||
"version": "1.2.2", | ||
"copyright": "Copyright 2016 Ayogo Health Inc.", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
Sorry, the diff of this file is not supported yet
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
531740
9898