Skip to content

Commit

Permalink
do not move toolbar when page scroll
Browse files Browse the repository at this point in the history
  • Loading branch information
sofish committed Sep 6, 2013
1 parent 760e1f7 commit fda0ea2
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions src/pen.js
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@

Pen.prototype.toolbar = function() {

var menu, that = this, icons = '';
var menu, that = this, icons = '', setpos;

for(var i = 0, list = this.config.list; i < list.length; i++) {
var name = list[i], klass = 'pen-icon icon-' + name;
Expand All @@ -130,13 +130,13 @@

doc.body.appendChild((this._menu = menu));

// change menu offset when window resize
window.addEventListener('resize', function() {
if(menu.style.display === 'block') {
menu.style.display = 'none';
that.menu();
}
});
setpos = function() {
if(menu.style.display === 'block') that.menu();
}

// change menu offset when window resize / scroll
window.addEventListener('resize', setpos);
window.addEventListener('scroll', setpos);

// show toolbar on select
this.config.editor.addEventListener('mouseup', function(){
Expand Down

0 comments on commit fda0ea2

Please sign in to comment.