-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathfuncCovgExample.tex
47 lines (41 loc) · 1001 Bytes
/
funcCovgExample.tex
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
47
\begin{figure}
%\medskip
\begin{lstlisting}
var currentDim=20;
function cellClicked() {
var divTag = '<div id='divElem' />';
if($(this).attr('id') == 'cell0'){
$('#cell0').after(divTag);
$('div #divElem').click(setup);
}
else if($(this).attr('id') == 'cell1'){
$('#cell1').after(divTag);
$('div #divElem').click(function(){setDim(20)});
}
}
function setup() {
setDim(10);
$('#startCell').click(start);
}
function setDim(dimension) {
var dim=($('#endCell').width() + $('#endCell').height()))/dimension;
currentDim += dim;
$('#endCell').css('height', dim+'px');
return dim;
}
function start() {
if(currentDim > 40)
$(this).css('height', currentDim+'px');
else $(this).remove();
}
$document.ready(function() {
...
$('#cell0').click(cellClicked);
$('#cell1').click(cellClicked);
});
\end{lstlisting}
\vspace{-0.1in}
\caption{\javascript code of the running example.}
\label{Fig:funcCovgExample}
\vspace{-0.2in}
\end{figure}