Answer the question
In order to leave comments, you need to log in
Javascript OOP?
Good afternoon! I'm trying to learn OOP javascript with real examples and ran into a problem. There is this code:
function Widget(containerSelector) {
this.$container = $(containerSelector);
this.$widgetIco = this.$container.find('.js-box-ico');
this.bindEvents();
}
Widget.prototype.bindEvents = function() {
this.$widgetIco
.on('mouseenter', this.addCell.bind(this))
.on('mouseleave', this.removeCell.bind(this));
};
Widget.prototype.addCell = function() {
// Добавить класс к наведенному элементу.
};
$(function() {
new Widget('.box');
});
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question