diff options
Diffstat (limited to 'js/slide.js')
-rw-r--r-- | js/slide.js | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/js/slide.js b/js/slide.js index befaa6d..ddf294d 100644 --- a/js/slide.js +++ b/js/slide.js @@ -24,6 +24,26 @@ Slide.prototype.updateTarget = function() { this.target = this.x + firstMargin + this.width * this.parent.cellAlign; }; +Slide.prototype.select = function() { + this.changeSelectedClass('add'); +}; + +Slide.prototype.unselect = function() { + this.changeSelectedClass('remove'); +}; + +Slide.prototype.changeSelectedClass = function( method ) { + this.cells.forEach( function( cell ) { + cell.element.classList[ method ]('is-selected'); + }); +}; + +Slide.prototype.getCellElements = function() { + return this.cells.map( function( cell ) { + return cell.element; + }); +}; + window.Slide = Slide; })(); |