Skip to content

Instantly share code, notes, and snippets.

@tkh44
Last active December 12, 2015 05:59
Show Gist options
  • Save tkh44/4725958 to your computer and use it in GitHub Desktop.
Save tkh44/4725958 to your computer and use it in GitHub Desktop.
if ( boxId in elements.collapsedBoxes ) {
// TODO: This should be changed to yui3 fade,slide???
//Show
var showAnim = new Y.Anim({
node: bodyNode,
to: {
height: function(node) {
return node.getData('old-height');
},
paddingTop: '9px',
paddingBottom: '15px',
opacity: 1.0
},
easing: 'easeOut',
duration: 0.5
});
//Calculate the proper height to expand to before the animation begins
// "start" event is too late so must be done on "init"
showAnim.on('init', function(e) {
var node = showAnim.get('node');
node.removeClass('hide');
node.setStyle('height', 'auto');
node.setData('old-height', node.getComputedStyle('height'));
node.setStyle('height', '0');
});
showAnim.on('end', function(e) {
showAnim.get('node').setStyle('height', 'auto');
});
showAnim.run();
delete elements.rollingBoxes[boxId];
delete elements.collapsedBoxes[boxId];
}
else {
// HIDE
var hideAnim = new Y.Anim({
node: bodyNode,
to: {
height: 0,
paddingTop: 0,
paddingBottom: 0,
opacity: 0.0
},
easing: 'easeOut',
duration: 0.5
});
hideAnim.run();
delete elements.rollingBoxes[boxId];
elements.collapsedBoxes[boxId] = true;
}
if (!no_nvdata) setBoxStatus();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment