ООП в js. Проблема
Пытаюсь изучить ООП javascript на реальный примерах и столкнулся с проблемой. Есть такой код:
function Widget(containerSelector) { this.$container = $(containerSelector); this.$widgetIco = this.$container.find('.js-box-ico'); this.$cell = this.$container.find('.js-cell'); this.cellRedClass = this.$cell.data('cellRedClass'); this.bindEvents(); } Widget.prototype.bindEvents = function() { this.$widgetIco .on('mouseenter', this.addCell.bind(this)) .on('mouseleave', this.removeCell.bind(this)); }; Widget.prototype.addCell = function() { // Добавить класс к наведенному элементу. выбранный элемент при ховере.addClass(this.cellRedClass); }; $(function() { new Widget('.box'); }); Не могу понять, как, к примеру, добавить класс в Widget.prototype.addCell к текущему наведенному мышкой элемменту .js-box-ico? |
Часовой пояс GMT +3, время: 18:45. |