/
index.html
87 lines (83 loc) · 4.28 KB
/
index.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
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>useOverflowEvent</title>
<meta name="Keywords" content="overflow,event,javascript,overflowchanged,underflow"/>
<meta name="Description" content="Way to detect overflow event support and use it with graceful degradation."/>
<link rel="stylesheet" href="http://fonts.googleapis.com/css?family=Libre+Baskerville">
<link rel="stylesheet" href="assets/index.css" />
<link rel="stylesheet" href="http://cdnjs.cloudflare.com/ajax/libs/prettify/r298/prettify.min.css" />
<script type="text/javascript" src="src/useOverflowEvent.js"></script>
</head>
<body>
<div class="header">
<div class="container">
<h1>useOverflowEvent</h1>
<p>Way to detect overflow event support and use it with graceful degradation. Overflow event is supported on Chrome(tested on 9+) and Firefox(tested on 1.5+).</p>
<div>
<iframe src="http://ghbtns.com/github-btn.html?user=zmmbreeze&repo=useOverflowEvent&type=watch&count=true&size=large"
allowtransparency="true" frameborder="0" scrolling="0" width="140" height="30"></iframe>
<iframe src="http://ghbtns.com/github-btn.html?user=zmmbreeze&repo=useOverflowEvent&type=fork&count=true&size=large"
allowtransparency="true" frameborder="0" scrolling="0" width="140" height="30"></iframe>
<a href="https://twitter.com/share" data-text="Way to detect overflow event support and use it with graceful degradation." data-size="large" data-related="zhoumm" data-hashtags="useOverflowEvent" data-url="http://nodejs.in/useOverflowEvent/" class="twitter-share-button">Tweet</a>
<script>!function(d,s,id){var js,fjs=d.getElementsByTagName(s)[0],p=/^http:/.test(d.location)?'http':'https';if(!d.getElementById(id)){js=d.createElement(s);js.id=id;js.src=p+'://platform.twitter.com/widgets.js';fjs.parentNode.insertBefore(js,fjs);}}(document, 'script', 'twitter-wjs');
</script>
</div>
</div>
</div>
<div class="container">
<div id="demo">
<div contenteditable>Add some text here to make it `overflow`.<br/></div>
</div>
<div id="status"></div>
<h2>HOW TO USE</h2>
<pre class="prettyprint lang-html"><script src="http://nodejs.in/useOverflowEvent/src/useOverflowEvent.js"></script>
<script>
useOverflowEvent(function (addOverflowListener) {
if (!addOverflowListener) {
// browser not support overflow event
// do somethings or nothing
return;
}
var container = document.getElementById('demo');
addOverflowListener(container, 'over', function () {
console.log('overflow');
});
addOverflowListener(container, 'under', function () {
console.log('underflow');
});
});
</script></pre>
</div>
<a href="https://github.com/zmmbreeze/useOverflowEvent"><img style="position: absolute; top: 0; right: 0; border: 0;" src="https://s3.amazonaws.com/github/ribbons/forkme_right_darkblue_121621.png" alt="Fork me on GitHub"></a>
<script>
useOverflowEvent(function (addOverflowListener) {
var status = document.getElementById('status');
status.innerHTML = 'Overflow event ' + (addOverflowListener ? 'supported' : 'not supported');
if (!addOverflowListener) {
// browser not support
return;
}
var container = document.getElementById('demo');
addOverflowListener(container, 'over', function () {
status.innerHTML = 'overflow';
});
addOverflowListener(container, 'under', function () {
status.innerHTML = 'underflow';
});
});
</script>
<script src="http://cdnjs.cloudflare.com/ajax/libs/prettify/r298/run_prettify.min.js"></script>
<script>
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-36422454-1']);
_gaq.push(['_trackPageview']);
(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();
</script>
</body>
</html>