Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

remove / separeted _viewElement #33

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion examples/04-random-tests.html
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,10 @@ <h3>Lorem ipsum dolor sit amet, consectetur adipisicing elit.</h3>
}).create()

var ex7 = new GeminiScrollbar({
element: document.querySelector('#example-7')
element: document.querySelector('#example-7'),
onResize: function() {
console.log(this.getViewElement());
}
}).create()
}
</script>
Expand Down
13 changes: 0 additions & 13 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,19 +92,6 @@
addClass(this.element, [CLASSNAMES.prevented]);

if (this.onResize) {
// still need a resize trigger if we have an onResize callback, which
// also means we need a separate _viewElement to do the scrolling.
if (this.createElements === true) {
this._viewElement = document.createElement('div');
while(this.element.childNodes.length > 0) {
this._viewElement.appendChild(this.element.childNodes[0]);
}
this.element.appendChild(this._viewElement);
} else {
this._viewElement = this.element.querySelector('.' + CLASSNAMES.view);
}
addClass(this.element, [CLASSNAMES.element]);
addClass(this._viewElement, [CLASSNAMES.view]);
this._createResizeTrigger();
}

Expand Down