@GreenMan1899

Как создать такой же блок «подробнее»?

  • Вопрос задан
  • 243 просмотра
Пригласить эксперта
Ответы на вопрос 2
ant1vit
@ant1vit
Readmore.js

У них такой код
$('.controller').on('click', function(){
            $this = $(this);
            $target = $this.siblings('.tall').eq(0);
            if($this.hasClass('less')){
                $target.animate({
                    height: xpander_init+'px',
                }, function(){
                    $this.removeClass('less').addClass('more');
                    $this.find('span').text('Подробнее');
                    $this.trigger('scrollto');
                });

            }else if($this.hasClass('more')){
                $target.animate({
                    height: $target.data('init-hg')+'px',
                }, function(){
                    $this.removeClass('more').addClass('less');
                    $this.find('span').text('Скрыть');
                    $this.trigger('scrollto');
                });
            }
            return false;
        }).on('scrollto', function(){
            $('body, html').animate({
                scrollTop: $(this).offset().top -
                           (window.innerHeight - $this.height()*2),
            }, 600);
        });
Ответ написан
webinar
@webinar
Учим yii: https://youtu.be/-WRMlGHLgRg
Это же обычный аккордеон, миллион таких скриптов в сети:
https://yandex.ru/search/?text=jquery%20аккордеон&...
Ответ написан
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы