Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Recalculate scrollbar size when .slimscroll() is called again. Extremely
useful when we update the content dynamically / using ajax.
- Loading branch information
Showing
2 changed files
with
111 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> | ||
<html> | ||
<head> | ||
<title>jquery.slimscroll - dynamic content</title> | ||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /> | ||
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.9.0/jquery.min.js"></script> | ||
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.10.1/jquery-ui.min.js"></script> | ||
<link href="libs/prettify/prettify.css" type="text/css" rel="stylesheet" /> | ||
<script type="text/javascript" src="libs/prettify/prettify.js"></script> | ||
<script type="text/javascript" src="../jquery.slimscroll.js"></script> | ||
<link href="style.css" type="text/css" rel="stylesheet" /> | ||
</head> | ||
<body> | ||
<a id="git-fork" href="https://github.com/rochal/jQuery-slimScroll"><img src="https://s3.amazonaws.com/github/ribbons/forkme_right_red_aa0000.png" alt="Fork me on GitHub"></a> | ||
<div class="examples"> | ||
|
||
|
||
<div id="testDiv"> | ||
</div> | ||
|
||
<pre class="prettyprint"> | ||
// update content every second | ||
setInterval(function(){ | ||
var el = $('<div></div>').html('#' + $('#testDiv').children().length) | ||
.css({ padding: '3px', border: '1px solid #ccc', margin: '5px' }); | ||
$('#testDiv').append(el); | ||
|
||
// update slimscroll every time content changes | ||
$('#testDiv').slimscroll(); | ||
}, 1000); | ||
|
||
$('#testDiv').slimscroll({ | ||
alwaysVisible: true, | ||
height: 150 | ||
}); | ||
</pre> | ||
|
||
|
||
|
||
</div> | ||
|
||
<script type="text/javascript"> | ||
$(function(){ | ||
|
||
// update content every second | ||
setInterval(function(){ | ||
var el = $('<div></div>').html('#' + $('#testDiv').children().length) | ||
.css({ padding: '3px', border: '1px solid #ccc', margin: '5px' }); | ||
$('#testDiv').append(el); | ||
|
||
// update slimscroll every time content changes | ||
$('#testDiv').slimscroll(); | ||
}, 1000); | ||
|
||
$('#testDiv').slimscroll({ | ||
alwaysVisible: true, | ||
height: 150 | ||
}); | ||
|
||
}); | ||
</script> | ||
|
||
|
||
<script type="text/javascript"> | ||
|
||
//enable syntax highlighter | ||
prettyPrint(); | ||
|
||
var _gaq = _gaq || []; | ||
_gaq.push(['_setAccount', 'UA-3112455-22']); | ||
_gaq.push(['_setDomainName', 'none']); | ||
_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> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters