A simple responsive and mobile-friendly browser game made using plain JS and CSS.
- Experimenting with GitHub pages.
- Experimenting with jQuery. (You can see the first solution here)
But after several years I opened this project again and I noticed that I'm using less than 10 jQuery methods. And for those methods, I'm using 2 libraries (jQuery and jQuery UI) in total 328 KB (which is nonsense for this kind of app)...
Because of that, I changed those jQuery methods with vanilla JS and CSS.
- I replaced the famous jQuery dollar sign
$('selector')withdocument.querySelector('selector'). - Instead of jQuery
element.animate()I'm using CSS animationstransition: all 1.3s ease-in-out;, and after that whenever the background-color is changed there is an animation. - For manipulating with CSS classes
element.addClass('class')element.removeClass('class')element.hasClass('class')I'm usingelement.classList.add('class')element.classList.remove('class')element.classList.contains('class'). - For creating elements
$('<div></div>')I'm usingdocument.createElement('div'). - I replaced
element.show()andelement.hide()withelement.style.display = 'block'andelement.style.display = 'none'. - And also I replaced event listeners
element.on('event', function)withelement.addEventListener('event', function).
This project is licensed under the MIT - see the LICENSE file for details
