var canvas = document.getElementById('canvas');
var ctx = canvas.getContext('2d');
var Cube = function (x, y) {
this.x = x;
this.y = y;
};
var Stroke = function (x, y) {
this.x = x;
this.y = y;
};
Cube.prototype.draw = function (cube, sizeX, sizeY) {
ctx.fillRect(cube.x, cube.y, sizeX, sizeY);
};
Stroke.prototype.draw = function (stroke, sizeX, sizeY) {
ctx.strokeRect(stroke.x, stroke.y, sizeX, sizeY);
};
$('.button-changer').click(function () {
$('#canvas').toggleClass('stroke');
console.log($('#canvas').hasClass('stroke'))
});
$('#canvas').click(function (event) {
if ($('#canvas').hasClass('stroke')) {
var new2 = new Stroke(event.pageX - 3.5, event.pageY - 3.5, 2);
new2.draw(new2, 10, 10);
} else {
var new1 = new Cube(event.pageX - 3.5, event.pageY - 3.5);
new1.draw(new1, 10, 10);
}
});
.global-menu__item
все элементы меню исчезали? Или что бы все меню закрывалось?gNavItems.forEach((item, index) => (
item.addEventListener('click', (e) => {
overlay.close();
elmHamburger.classList.remove('is-opened-navi');
for(var i = 0; i < gNavItems.length; i++) {
gNavItems[i].classList.remove('is-opened');
}
})
));
import React from 'react';
import CSSModules from 'react-css-modules';
import styles from './table.css';
@CSSModules(styles)
export default class extends React.Component {
render () {
return <div styleName='table'>
<div styleName='row'>
<div styleName='cell'>A0</div>
<div styleName='cell'>B0</div>
</div>
</div>;
}
}
import React from 'react';
import styles from './table.css';
export default class Table extends React.Component {
render () {
return <div className={styles.table}>
<div className={styles.row}>
<div className={styles.cell}>A0</div>
<div className={styles.cell}>B0</div>
</div>
</div>;
}
}