Skip to content

Commit

Permalink
Correcting several more calls to update() function (#31)
Browse files Browse the repository at this point in the history
  • Loading branch information
Clint Buhs committed Apr 25, 2017
1 parent 71752e8 commit bf97e73
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 8 deletions.
2 changes: 1 addition & 1 deletion bower.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-perfect-scrollbar",
"version": "0.0.8",
"version": "0.0.9",
"description": "A directive to allow the use of Perfect Scrollbar in AngularJS",
"main": "src/angular-perfect-scrollbar.js",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "angular-perfect-scrollbar",
"version": "0.0.8",
"version": "0.0.9",
"private": false,
"main": "src/angular-perfect-scrollbar.js",
"scripts": {
Expand Down
16 changes: 11 additions & 5 deletions src/angular-perfect-scrollbar.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Angular Perfect scrollbar
* Version 0.0.8
* Version 0.0.9
* https://github.com/itsdrewmiller/angular-perfect-scrollbar
*/

Expand Down Expand Up @@ -61,7 +61,7 @@ angular
});
});

// automatically update when content height changes
// Automatically update when content height changes
$scope.$watch(function () {
return $elem.prop('scrollHeight');
}, function (newValue, oldValue) {
Expand Down Expand Up @@ -96,11 +96,17 @@ angular

// Rebuild on window resize
if ($attr.refreshOnResize) {
jqWindow.on('resize', update);
jqWindow.on('resize', function () {
update();
});
}

$elem.bind('$destroy', function () {
jqWindow.off('resize', update);
// Unbind resize event and destroy instance
$elem.on('$destroy', function () {
jqWindow.off('resize', function () {
update();
});

$elem.perfectScrollbar('destroy');
});
}
Expand Down
2 changes: 1 addition & 1 deletion src/angular-perfect-scrollbar.min.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit bf97e73

Please sign in to comment.