-
Notifications
You must be signed in to change notification settings - Fork 1.4k
/
Copy pathexample.html
52 lines (47 loc) · 1.15 KB
/
example.html
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
48
49
50
51
52
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title>jQuery.fitText Additional Options</title>
<style>
html {
font-family:sans-serif;
}
h1 {
text-transform:uppercase;
font-size:1em;
}
span {
cursor:pointer;
}
</style>
<script src="http://code.jquery.com/jquery-1.7.min.js"></script>
<script src="jquery.fittext.js"></script>
<script>
//You should never run `fitText()` before the page is fully rendered
//(i.e. `window.onload`) because `width()` may not be work properly.
$(window).bind("load", function(){
var q_updateSize=true;
$("h1").fitText({
"compressor":1.97,
"proxy":$("body"),
"before":function(size){
console.log(size, this);
return q_updateSize;
},
"after":function(size){
console.log(size, this);
}
});
$("span").bind("click", function(){
q_updateSize=!q_updateSize;
});
});
</script>
</head>
<body>
<h1>jQuery.fitText Additional Options</h1>
<p><span>Click to toggle FitText</span></p>
<p>101</p>
</body>
</html>