Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

62
Vistas
Prevent reload when URL is changed

I am currently building a website with Kirby CMS and are using Parameters in the URL to filter my articles. At the same time i have a very basic css switcher implemented, which enables me to switch between list and gallery view without any reloads (I assumed). But when I am in gallery view (the css only loaded when the switcher is used) and the url changes to pass the parameters for the filter, the site reverts to the initial css (list view). How can i prevent that from happening?

My humble CSS Switcher

function list() {
  var theme = document.getElementById('css');
  theme.href = "/assets/css/templates/works.css";
}

function gallery() {
  var theme = document.getElementById('css');
  theme.href = "/assets/css/templates/works-gallery.css";
}

Filter

<filter class="filter">
  <a href="<?= $page->url() ?>?filter=">All</a>
  <?php foreach ($filters as $filter): ?>
  <a href="?filter=<?= $filter ?>"><?= $filter ?></a>
  <?php endforeach ?>
</filter>

Respective Page Controller

return function ($page) {

  $filterBy   = get('filter');
  $unfiltered = $page->children()->listed();
  $works      = $unfiltered
  ->when($filterBy, function($filterBy) {
    return $this->filterBy('category', $filterBy);
  });
  $filters    = $unfiltered->pluck('category', null, true);

  return [
    'filterBy'    => $filterBy,
    'unfiltered'  => $unfiltered,
    'works'       => $works,
    'filters'     => $filters
  ];

};
about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda