Skip to content

Instantly share code, notes, and snippets.

View mankutila's full-sized avatar
✌️

Maša Piaredryj mankutila

✌️
View GitHub Profile
@mankutila
mankutila / highlight.js
Created November 1, 2017 09:29
Highlight random article on raindrop.io
var articles = document.querySelectorAll(".element"),
index = Math.round(Math.random() * (articles.length + 1));
articles[index].style.background = "lime";
@mankutila
mankutila / tabs.js
Last active November 9, 2017 10:56
Tabs on pure JS
var tabLinks = document.querySelectorAll('ul.tabs li a');
tabLinks[0].setAttribute('class', 'tab--active');
document.querySelectorAll('section.tab-content')[0].style.display = 'block';
for (var i = 0; i < tabLinks.length; i++) {
tabLinks[i].onclick = function() {
var target = this.getAttribute('href').replace('#', '');
var sections = document.querySelectorAll('section.tab-content');
for(var j=0; j < sections.length; j++) {