Skip to content

Commit

Permalink
🔖 Release v2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
oscarstranger committed Jul 31, 2018
1 parent 80f1b13 commit 7ce138f
Show file tree
Hide file tree
Showing 4 changed files with 25 additions and 20 deletions.
2 changes: 1 addition & 1 deletion dist/focus-min.js

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

30 changes: 17 additions & 13 deletions dist/focus.js
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ Focus.removeClass = function removeAClassFromAGivenElement(element, className) {
};

Focus.prototype.slideDown = function slideDown() {
var _this = this;

var el = this.element;
// Display none
var defaultDisplay = this.element.style.display;
Expand All @@ -204,38 +206,40 @@ Focus.prototype.slideDown = function slideDown() {

var adder = this.maxHeight / 100;
// Iteratively increase the height
this.interval = setInterval(function interval() {
this.counter += adder;
if (this.counter < this.maxHeight) {
el.style.maxHeight = this.counter + 'px';
this.interval = setInterval(function () {
_this.counter += adder;
if (_this.counter < _this.maxHeight) {
el.style.maxHeight = _this.counter + 'px';
} else {
el.style.maxHeight = null;
el.style.overflow = null;
this.height = this.element.offsetHeight;
clearInterval(this.interval);
_this.height = _this.element.offsetHeight;
clearInterval(_this.interval);
}
}.bind(this), this.settings.slideSpeed / 100);
}, this.settings.slideSpeed / 100);
};

Focus.prototype.slideUp = function slideUp() {
var _this2 = this;

var el = this.element;
var subtractor = this.maxHeight / 100;
// To hide the content of the element
el.style.overflow = 'hidden';

// Decreasing the height
this.interval = setInterval(function interval() {
this.counter -= subtractor;
if (this.counter > 0) {
el.style.maxHeight = this.counter + 'px';
this.interval = setInterval(function () {
_this2.counter -= subtractor;
if (_this2.counter > 0) {
el.style.maxHeight = _this2.counter + 'px';
} else {
el.style.maxHeight = null;
el.style.display = 'none';
el.style.overflow = null;

clearInterval(this.interval);
clearInterval(_this2.interval);
}
}.bind(this), this.settings.slideSpeed / 100);
}, this.settings.slideSpeed / 100);
};

/*
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": "Focus",
"version": "2.1.0",
"version": "2.2.0",
"license": "SEE LICENSE IN LICENSE",
"description": "Front end visibility manager for popups, modals notifications, drawers, accordions and tabs",
"repository": {
Expand Down
11 changes: 6 additions & 5 deletions src/focus.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
|\
|/
Focus v2.2
Focus
version v2.2
https://github.com/Elkfox/Focus
Copyright (c) 2018 Elkfox Co Pty Ltd
Expand Down Expand Up @@ -196,7 +197,7 @@ Focus.prototype.slideDown = function slideDown() {

const adder = this.maxHeight / 100;
// Iteratively increase the height
this.interval = setInterval(function interval() {
this.interval = setInterval(() => {
this.counter += adder;
if (this.counter < this.maxHeight) {
el.style.maxHeight = `${this.counter}px`;
Expand All @@ -206,7 +207,7 @@ Focus.prototype.slideDown = function slideDown() {
this.height = this.element.offsetHeight;
clearInterval(this.interval);
}
}.bind(this), this.settings.slideSpeed / 100);
}, this.settings.slideSpeed / 100);
};

Focus.prototype.slideUp = function slideUp() {
Expand All @@ -216,7 +217,7 @@ Focus.prototype.slideUp = function slideUp() {
el.style.overflow = 'hidden';

// Decreasing the height
this.interval = setInterval(function interval() {
this.interval = setInterval(() => {
this.counter -= subtractor;
if (this.counter > 0) {
el.style.maxHeight = `${this.counter}px`;
Expand All @@ -227,7 +228,7 @@ Focus.prototype.slideUp = function slideUp() {

clearInterval(this.interval);
}
}.bind(this), this.settings.slideSpeed / 100);
}, this.settings.slideSpeed / 100);
};

/*
Expand Down

0 comments on commit 7ce138f

Please sign in to comment.