Concentration Game
How do I make an concentration game?
This is a simple concentration game made with pure javascript without any library. In the boxes you will see social media icons. Can you find same social media icons repeatedly ?. What is a concentration game? How do you make a concentration game? This script and codes were developed by Krishna Babu on 11 January 2023, Wednesday.
Concentration Game - Script Codes HTML Codes
<!DOCTYPE html>
<html >
<head> <meta charset="UTF-8"> <title>Concentration Game</title> <link rel="stylesheet" href="css/style.css">
</head>
<body> <div id="container"> <h1>Concentration Game</h1><p>This is a simple concentration game made with pure javascript without any library. In the boxes you will see social media icons. Can you find same social media icons repeatedly ?</p></br> <div class="holder"> <ul></ul> </div>
</div> <script src='http://cdnjs.cloudflare.com/ajax/libs/jquery/2.1.3/jquery.min.js'></script> <script src="js/index.js"></script>
</body>
</html>
Concentration Game - Script Codes CSS Codes
*{margin:0; padding:0;}
body{background-color:#000;color:#fff;font-family:arial;}
#container{height:auto;width:100%;}
.holder{background-color:#777;width:515px;height:682px;margin:0 auto;position:relative;}
.holder ul{list-style:none;position:relative;float:left;}
.holder ul li{height:74px;width:74px;background-color:#000;margin:10px;float:left;margin-right:0px;margin-bottom:0px;}
.holder ul li div{height:74px;width:74px;background:url(http://flashadicts.com/clientdisplay/images/matching.png);opacity:0;}
Concentration Game - Script Codes JS Codes
$(document).ready(function(){ var array1 = []; var array2 = []; var val=0; var indexBox=-1; for(i=0; i<24; i++){ val = 7+(Math.round(Math.random()*5)*94); console.log(val); array1.push(val); array1.push(val); } for(i=0; i<48; i++){ //console.log(Math.round(Math.random()*(array1.length-1))); val = Math.round(Math.random()*(array1.length-1)); array2.push(array1[val]); array1.splice( val, 1); } for(i=0; i<48; i++){ $(".holder ul").append('<li><div style="background-position:-'+array2[i]+'px" data-pos='+array2[i]+'></div></li>'); } val=0; $(".holder ul li>div").click(function(){ $(this).css('opacity','1'); $(this).animate({opacity:1},500); if(val==0){ val = $(this).data("pos"); indexBox = $(this).parent('li').index(); }else{ if(val == $(this).data("pos")){ $('li:eq('+indexBox+')').animate({opacity:0},500); $(this).parent().animate({opacity:0},500); }else{ $(this).animate({opacity:0},500); $('li:eq('+indexBox+') div').animate({opacity:0},500); } val=0; } });
});
Developer | Krishna Babu |
Username | krishnab |
Uploaded | January 11, 2023 |
Rating | 3 |
Size | 2,427 Kb |
Views | 2,024 |
Find the perfect freelance services for your business! Fiverr's mission is to change how the world works together. Fiverr connects businesses with freelancers offering digital services in 500+ categories. Find Developer!
Name | Size |
Calender | 2,736 Kb |
Page | 1,939 Kb |
Responsive Calendar | 3,174 Kb |
Bootstrap Carousel | 2,027 Kb |
Css3 shapes | 2,518 Kb |
No effect slideshow | 2,123 Kb |
Paging | 2,753 Kb |
Flat UI Color Gradients | 1,821 Kb |
Delhi Metro | 6,344 Kb |
Javascript Tab | 2,394 Kb |
Jasper is the AI Content Generator that helps you and your team break through creative blocks to create amazing, original content 10X faster. Discover all the ways the Jasper AI Content Platform can help streamline your creative workflows. Start For Free!
Name | Username | Size |
Mini Profile | Frytyler | 3,828 Kb |
Flexbox playground | Enxaneta | 5,418 Kb |
Cut and Paste Roll Link | BottomlineInteractive | 2,546 Kb |
BlueBox Fork | Huskynation | 12,675 Kb |
NeeilTimer | Neeilan | 2,836 Kb |
CSS Social Media Icon | TychoBlender | 3,871 Kb |
A Pen by MurabitoB | MurabitoB | 4,421 Kb |
HEXAGON | Aurumlux | 1,684 Kb |
A Pen by Miro Olma | Programiro | 2,342 Kb |
Voting App - register | MatheusLima92 | 1,948 Kb |
Surf anonymously, prevent hackers from acquiring your IP address, send anonymous email, and encrypt your Internet connection. High speed, ultra secure, and easy to use. Instant setup. Hide Your IP Now!