2015-01-27 00:32:33 +08:00
|
|
|
<!DOCTYPE html>
|
2014-11-06 03:02:00 +08:00
|
|
|
<html>
|
|
|
|
<head>
|
|
|
|
<meta http-equiv="content-type" content="text/html; charset=utf-8">
|
|
|
|
<title>perfect-scrollbar example</title>
|
2015-02-13 03:56:27 +08:00
|
|
|
<link href="../dist/css/perfect-scrollbar.css" rel="stylesheet">
|
2015-02-13 04:08:09 +08:00
|
|
|
<script src="../dist/js/perfect-scrollbar.js"></script>
|
2014-11-06 03:02:00 +08:00
|
|
|
<style>
|
|
|
|
#test {
|
|
|
|
border: 1px solid gray;
|
|
|
|
max-height: 300px;
|
|
|
|
width: 400px;
|
2015-02-19 00:36:10 +08:00
|
|
|
overflow: scroll;
|
2014-11-06 03:02:00 +08:00
|
|
|
position: relative;
|
|
|
|
}
|
|
|
|
#test .element {
|
|
|
|
margin: 1px;
|
|
|
|
background-color: #cec;
|
|
|
|
height: 44px;
|
|
|
|
line-height: 44px;
|
|
|
|
}
|
|
|
|
</style>
|
|
|
|
</head>
|
|
|
|
<body>
|
|
|
|
<div id="test" class="wrapper">
|
|
|
|
<div class='element'>Hello! Click <a href='#'>here</a> to remove this!</div>
|
|
|
|
<div class='element'>Hello! Click <a href='#'>here</a> to remove this!</div>
|
|
|
|
<div class='element'>Hello! Click <a href='#'>here</a> to remove this!</div>
|
|
|
|
<div class='element'>Hello! Click <a href='#'>here</a> to remove this!</div>
|
|
|
|
<div class='element'>Hello! Click <a href='#'>here</a> to remove this!</div>
|
|
|
|
<div class='element'>Hello! Click <a href='#'>here</a> to remove this!</div>
|
|
|
|
<div class='element'>Hello! Click <a href='#'>here</a> to remove this!</div>
|
|
|
|
<div class='element'>Hello! Click <a href='#'>here</a> to remove this!</div>
|
|
|
|
<div class='element'>Hello! Click <a href='#'>here</a> to remove this!</div>
|
|
|
|
<div class='element'>Hello! Click <a href='#'>here</a> to remove this!</div>
|
|
|
|
<div class='element'>Hello! Click <a href='#'>here</a> to remove this!</div>
|
|
|
|
<div class='element'>Hello! Click <a href='#'>here</a> to remove this!</div>
|
|
|
|
</div>
|
2015-01-27 00:32:33 +08:00
|
|
|
<script type="text/javascript">
|
|
|
|
var $ = document.querySelector.bind(document);
|
|
|
|
window.onload = function () {
|
|
|
|
var test = $('#test');
|
|
|
|
Ps.initialize(test);
|
|
|
|
[].forEach.call(test.querySelectorAll('.element'), function (el) {
|
|
|
|
el.querySelector('a').addEventListener('click', function () {
|
|
|
|
el.parentNode.removeChild(el);
|
|
|
|
Ps.update(test);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
};
|
|
|
|
</script>
|
2014-11-06 03:02:00 +08:00
|
|
|
</body>
|
|
|
|
</html>
|