Entony 7 سال پیش
والد
کامیت
d4f17dd91a
3فایلهای تغییر یافته به همراه10 افزوده شده و 2 حذف شده
  1. 7 0
      css/style.css
  2. 1 0
      index.html
  3. 2 2
      js/script.js

+ 7 - 0
css/style.css

@@ -0,0 +1,7 @@
+.black {
+	background: #000;
+}
+
+.white {
+	background: '';
+}

+ 1 - 0
index.html

@@ -5,6 +5,7 @@
 	<title>2017-28-08_click</title>
 	<link rel="stylesheet" href="bower_components/font-awesome/css/font-awesome.min.css">
 	<link rel="stylesheet" href="bower_components/bootstrap/dist/css/bootstrap.min.css">
+	<link rel="stylesheet" href="css/style.css">
 </head>
 <body>
 	<div class="container">

+ 2 - 2
js/script.js

@@ -19,12 +19,12 @@ $('td').on('click', function(event) {
 
 	if ( $(this).hasClass('white') ) {
 
- 		$(this).css({'background' : '#000', 'height' : '30px', 'width' : '30px'}).removeClass('white').addClass('black');
+ 		$(this).removeClass('white').addClass('black');
 		arr.push(this);
 
 	}else if( $(this).hasClass('black') ) {
 
-		$(this).css({'background' : '#fff', 'height' : '30px', 'width' : '30px'}).removeClass('black').addClass('white');
+		$(this).removeClass('black').addClass('white');
 		arr.splice(arr.indexOf(this), 1)		
 	}
 });