Skip to content

Instantly share code, notes, and snippets.

@Fobiya
Last active July 20, 2020 12:18
Show Gist options
  • Save Fobiya/90135771acae120591fc5b6e1ed6b4d1 to your computer and use it in GitHub Desktop.
Save Fobiya/90135771acae120591fc5b6e1ed6b4d1 to your computer and use it in GitHub Desktop.
Js Native
document.querySelectorAll('.fish-characteristic li').forEach(function(item){
item.addEventListener('click',function(){
document.querySelectorAll('.fish-characteristic li').forEach(function(item){
item.classList.remove('active');
});
var id = item.getAttribute('data-id');
document.querySelectorAll('.content__text').forEach(function(item2){
item2.style.display = "none";
});
document.querySelector('#' + id).style.display = "block";
item.classList.add('active');
});
});
// NATIVE LIST class link
document.querySelectorAll('.mte_news>.mte_new').forEach(function(item){
item.addEventListener('click',function(item){
this.querySelector("a.mte_news--link").click();
});
});
/---------------------------------------------------------------------------------------------------/
for(let link of document.querySelectorAll('.back_border')){
link.onclick = (e) =>{
if(e.target === link.querySelector('.link_open')){
link.classList.toggle('active');
// link.parentElement.classList.toggle('active');
}
}
}
@Fobiya
Copy link
Author

Fobiya commented Jul 20, 2020

for(let link of document.querySelectorAll('.link_open')){
link.onclick = (e) =>{
e.preventDefault();
link.parentElement.parentElement.classList.toggle('active');
link.parentElement.classList.toggle('active');
}
}

@Fobiya
Copy link
Author

Fobiya commented Jul 20, 2020

for(let link of document.querySelectorAll('.back_border')){
link.onclick = (e) =>{
if(e.target === link.querySelector('.link_open')){
link.classList.toggle('active');
// link.parentElement.classList.toggle('active');
}
}
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment