Ik ben bezig mijn JS library vanaf scratch op te bouwen, aangezien ik die kwijt was door een crash. Ik ben nu aangekomen bij een functie met één parameter, maar wel eentje die behoorlijk ingewikkeld is. Ik heb er vooraf al gelijk een stukje documentatie bij geschreven, zodat het zowel voor mij als voor anderen die de lib eventueel zullen gebruiken duidelijk is hoe je die functie moet gebruiken. Wat ik me nu echter afvraag is of de opbouw van die parameter en/of de documentatie misschien duidelijker kan. Wat de parameter betreft: Ik maak mijn library met het woord 'flexibiliteit' in mijn achterhoofd. Ik vind het zelf erg handig als iets flexibel werkt, het kost echter wel meer moeite het te maken of het te implementeren, vandaar dat de boel nu ook een beetje ingewikkeld is geworden volgens mij. Maargoed, hier de code, ik hoor jullie commentaar graag aan 
JavaScript:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
| /** Init function for new transformations @param oParams object Parameter object containing the transformation properties: - selector string CSS selector, for instance 'h1', '.error' or '#content' - styles array - $object object No-name object containing all transformation properties -- style string The style property to change -- duration integer Duration of the transformation in milliseconds. Should be a multiple of 5. -- transformation string Transformation type: 'linear', 'ease', 'easein' or 'easeout' Optional, defaults to 'linear' -- values array The start and end values for the style property. Logically, the start value is the first value in the array. -- unit string The unit to use for the style property, for instance 'px', 'em' or '%'. Optional -- callback object Information about the function to call after the transformation has been completed Optional --- function string Name of the function to call --- arguments array Arguments to pass on to the function --- timeout integer Time in milliseconds between completing the transformation and calling the callback function Example: $f.t.transform({ selector:'#content', styles:[ { style:'background-color', duration:45, transformation:'ease', values:[red, blue] }, { style:'width', duration:175, values:[20, 50], unit:'%' } ] }) This example code will change the background-colour from red to blue and the width from 20% to 50% for the element with ID=='content' */ $f.t.transform=function(oParams) { } |