2015-01-27 00:32:33 +08:00
|
|
|
<!DOCTYPE html>
|
2014-01-21 10:53:32 +08:00
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
|
|
|
<title>perfect-scrollbar example</title>
|
2015-01-16 07:24:17 +08:00
|
|
|
<link href="../out/css/perfect-scrollbar.css" rel="stylesheet">
|
2015-01-27 00:32:33 +08:00
|
|
|
<script src="../out/js/perfect-scrollbar.global.js"></script>
|
2014-01-21 10:53:32 +08:00
|
|
|
<style>
|
|
|
|
#description {
|
|
|
|
border: 1px solid gray;
|
|
|
|
height:150px;
|
|
|
|
width: 400px;
|
|
|
|
overflow: hidden;
|
|
|
|
position: relative;
|
|
|
|
}
|
2015-01-27 00:32:33 +08:00
|
|
|
#status { color: red; }
|
2014-01-21 10:53:32 +08:00
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div id="description" class="wrapper">
|
|
|
|
<p>Hello, world! 0</p>
|
|
|
|
<p>Hello, world! 1</p>
|
|
|
|
<p>Hello, world! 2</p>
|
|
|
|
<p>Hello, world! 3</p>
|
|
|
|
<p>Hello, world! 4</p>
|
|
|
|
<p>Hello, world! 5</p>
|
|
|
|
<p>Hello, world! 6</p>
|
|
|
|
<p>Hello, world! 7</p>
|
|
|
|
<p>Hello, world! 8</p>
|
|
|
|
<p>Hello, world! 9</p>
|
|
|
|
</div>
|
|
|
|
<div id="status">
|
|
|
|
</div>
|
2015-01-27 00:32:33 +08:00
|
|
|
<script type="text/javascript">
|
|
|
|
var $ = document.querySelector.bind(document);
|
|
|
|
window.onload = function () {
|
|
|
|
var container = $('#description');
|
|
|
|
var stat = $('#status');
|
|
|
|
Ps.initialize(container);
|
|
|
|
container.addEventListener('scroll', function (e) {
|
|
|
|
if(container.scrollTop === 0) {
|
|
|
|
stat.innerHTML = 'it reaches the top!';
|
|
|
|
}
|
|
|
|
else if (container.scrollTop === container.scrollHeight - container.clientHeight) {
|
|
|
|
stat.innerHTML = 'it reaches the end!';
|
|
|
|
} else {
|
|
|
|
stat.innerHTML = '';
|
|
|
|
}
|
|
|
|
});
|
|
|
|
};
|
|
|
|
</script>
|
2014-01-21 10:53:32 +08:00
|
|
|
</body>
|
|
|
|
</html>
|