mirror of
https://github.com/Jermolene/TiddlyWiki5
synced 2024-11-18 15:54:50 +00:00
a1c8ac624f
There are still some whitespace and attribute ordering issues, but the result runs correctly.
36 lines
1.2 KiB
JavaScript
Executable File
36 lines
1.2 KiB
JavaScript
Executable File
//--
|
|
//-- Slider animation
|
|
//--
|
|
|
|
// deleteMode - "none", "all" [delete target element and it's children], [only] "children" [but not the target element]
|
|
function Slider(element,opening,unused,deleteMode)
|
|
{
|
|
element.style.overflow = 'hidden';
|
|
if(opening)
|
|
element.style.height = '0px'; // Resolves a Firefox flashing bug
|
|
element.style.display = 'block';
|
|
var height = element.scrollHeight;
|
|
var p = [];
|
|
var c = null;
|
|
if(opening) {
|
|
p.push({style: 'height', start: 0, end: height, template: '%0px', atEnd: 'auto'});
|
|
p.push({style: 'opacity', start: 0, end: 1, template: '%0'});
|
|
p.push({style: 'filter', start: 0, end: 100, template: 'alpha(opacity:%0)'});
|
|
} else {
|
|
p.push({style: 'height', start: height, end: 0, template: '%0px'});
|
|
p.push({style: 'display', atEnd: 'none'});
|
|
p.push({style: 'opacity', start: 1, end: 0, template: '%0'});
|
|
p.push({style: 'filter', start: 100, end: 0, template: 'alpha(opacity:%0)'});
|
|
switch(deleteMode) {
|
|
case "all":
|
|
c = function(element,properties) {jQuery(element).remove();};
|
|
break;
|
|
case "children":
|
|
c = function(element,properties) {jQuery(element).empty();};
|
|
break;
|
|
}
|
|
}
|
|
return new Morpher(element,config.animDuration,p,c);
|
|
}
|
|
|