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

196
Vistas
Slick slider with readmore.js

I am making a reviews widget using slick slider. Some reviews are long and I need to hide them and I am trying to use the readmore.js plugin for this. Everything works fine, before I decrease the resolution to the first breakpoint, after that when I press' "read more" button the page is moved to the top or if add "/" after "a href" in the code the page just remains in the same place.

Here is the slick slider part

 <script src="https://assets.codepen.io/3490843/jquery-2.1.0.min.js"></script>
 
 <script src="https://assets.codepen.io/3490843/readmore.min.js"></script>

  <script src="https://assets.codepen.io/3490843/slick.min.js"></script>
    
 

<script type="text/javascript">
    $(document).ready(function(){

$('.multiple-items').slick({
   autoplaySpeed: 3000, 
  autoplay: false,
  infinite: true,
  slidesToShow: 3,
  slidesToScroll: 1,
  
responsive: [
    {
      breakpoint: 1024,
      settings: {
        slidesToShow: 3,
        slidesToScroll: 3,
        infinite: true,
        
      }
    },
    {
      breakpoint: 600,
      settings: {
        slidesToShow: 2,
        slidesToScroll: 2,
        adaptiveHeight: true
      }
    },
    {
      breakpoint: 480,
      settings: {
        slidesToShow: 1,
        slidesToScroll: 1
      }
    }
    // You can unslick at a given breakpoint now by adding:
    // settings: "unslick"
    // instead of a settings object
  ]
});
        });
  
  </script>

Readmore.js

<script>
 $(function() { 
 $('.demo').readmore({ 
 moreLink: '<a href="#">Read more...</a>', 
 lessLink: '<a href="#">Hide</a>', 
 collapsedHeight: 56, 
 speed: 200, 
 afterToggle: function(trigger, element, expanded) { 
 if(! expanded) { // The "Close" link was clicked 
 $('html, body').animate({scrollTop: $(element).offset().top}, {duration: 100}); 
 } 
 } 
 }); 
 });
</script>

What am i doing wrong?

about 4 years ago · Juan Pablo Isaza
1 Respuestas
Responde la pregunta

0

You can use javascript:; to the default action of the event (e.g. following a link)

moreLink: '<a href="javascript:;">Read more...</a>', 
lessLink: '<a href="javascript:;">Hide</a>', 

OR

use jQuery ( Assuming you are using demo as a parent class )

$('.demo a').click(function(event) {
    event.preventDefault();
});
about 4 years ago · Juan Pablo Isaza Denunciar
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