This repository has been archived by the owner on Jan 24, 2024. It is now read-only.
forked from CezaryDanielNowak/css-resize-polyfill
-
Notifications
You must be signed in to change notification settings - Fork 0
/
demo.html
88 lines (75 loc) · 2.05 KB
/
demo.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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Resize-polyfill</title>
<style type="text/css">
.demo-no-polyfill-wrapper textarea,
.resize-polyfill-wrapper textarea {
border: 1px solid #BFBFBF;
resize: both;
min-height: 50px;
}
textarea {
padding: 0;
}
</style>
</head>
<body>
<div style="float:left; width:33.3%">
<h3>Before</h3>
<div class="demo-no-polyfill-wrapper">
<textarea>I am TEXTAREA.</textarea>
</div>
<br />
<div class="demo-no-polyfill-wrapper"
style="width: 250px; height: 60px; background: #B00B1E; color: #FFF">
I am DIV
</div>
</div>
<div style="float:left; width:33.3%">
<h3>After</h3>
<!-- ******* -->
<!-- 1. Make sure textarea have parent element! -->
<!-- ******* -->
<div>
<textarea class="resize-me">I am TEXTAREA.</textarea>
</div>
<br />
<div class="resize-me"
style="width: 250px; height: 60px; background: #B00B1E; color: #FFF">
I am DIV
</div>
</div>
<div style="float:left; width:33.3%">
<h3>After (force=true)</h3>
<div class="force-polyfill">
<textarea>I am TEXTAREA.</textarea>
</div>
<br />
<div class="force-polyfill"
style="width: 250px; height: 60px; background: #B00B1E; color: #FFF">
I am DIV
</div>
</div>
<div id="info" style="background:#AFA; clear: both; border-top: 20px solid #FFF; text-align:center;">
Resize handler added:
</div>
<!-- ******* -->
<!-- 2. attach lib/polyfill-resize.js -->
<!-- ******* -->
<script type="text/javascript" src="lib/polyfill-resize.js"></script>
<script>
// *******
// 3. call two following lines. Pick any selector/className instead of .resize-me
// *******
var el = document.getElementsByClassName('resize-me');
resizeHandlerPolyfill(el);
// end.
// for demo purposes
el = document.getElementsByClassName('force-polyfill');
resizeHandlerPolyfill(el, true);
document.getElementById('info').innerHTML += resizeHandlerPolyfill(false);
</script>
</body>
</html>