Bootstrap 4 Accordian scroll to open content?

前端 未结 1 1532
死守一世寂寞
死守一世寂寞 2020-12-21 20:56

I understand this question has been asked and I\'m working with sample code of someone who asked a similar question (Bootstrap accordion, scroll to top of active (open) acco

1条回答
  •  被撕碎了的回忆
    2020-12-21 21:24

    Please have a look at below snippet

    $('.panel-collapse').on('shown.bs.collapse', function(e) {
      var $panel = $(this).attr("id")
      console.log($panel)
      $('html, body').animate({
        scrollTop: $('#' + $panel).offset().top
      }, 500);
    });
    
    
    
    
      Bootstrap Example
      
      
      
      
      
      
    
    
    
    
      

    Featured Video

    Women's Self-Defense

    Train With Us

    Why You Should

    Your Instructor

    Get To Know Us

    Women's Self-Defense Course

    This is a video of a Women's Self-Defense Class given at Sam Houston State University. While watching a video isn't as good as attending a course, there is still a lot that can be learned from watching this online course. If you practice the skills presented in the video you can improve your chances of surviving an attack.

    Click the play button to see a short clip of the class.

    Why join Mousel's Mixed Martial Arts Academy

    Why you sould choose us...

    Sharing knowledge and helping others reach their full potential is what we do best.

    The martial arts were originally aimed towards life preservation and self defense, but today people come to us from all walks of life, each with their own set of reasons for wanting to train at Mousel’s Mixed Martial Arts Academy. Some want to learn self defense, others want to fight competitively, some seek to become physically fit and others just want to have fun. Whatever the reason you chose, you will find others just like yourself studying at Mousel’s Mixed Martial Arts Academy.

    Tim Mousel

    Tim Mousel is the owner of Mousel's Mixed Martial Arts AcademyWomen's Self-Defense, and The Edge Personal Training.

    Tim has trained many of Houston's top martial arts instructors and has students he has trained compete at the highest levels of mixed martial arts competition including the Ultimate Fighting Championship (UFC), King of the Cage, Pride, national kickboxing and Thai boxing championships, amateur and professional boxing. Tim was also the Strength and Conditioning Coach for two-time world boxing champion Reggie Johnson.

    0 讨论(0)
提交回复
热议问题