Skip to content

Instantly share code, notes, and snippets.

@exmmth
Created March 3, 2023 11:55
Show Gist options
  • Save exmmth/e6817a6524c9da508067ee663ba6c953 to your computer and use it in GitHub Desktop.
Save exmmth/e6817a6524c9da508067ee663ba6c953 to your computer and use it in GitHub Desktop.
this code hides current page block from grid blocks, uk-grid yootheme pro page builder
//hide current page from grid
let grid_class = 'fix-grid';//name of the grid class
if(document.querySelectorAll('.' + grid_class).length){
let cur_url = window.location.pathname,
grid_list = document.querySelectorAll('.' + grid_class +' > div > div');
Array.prototype.forEach.call(grid_list, function(el){
if(el.querySelectorAll('a')[0].getAttribute('href') == cur_url){
el.classList.add('uk-hidden');
}
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment