Skip to content Skip to sidebar Skip to footer

Navigate To Bootstrap Accordion From Another Page

I have created a resources site that has multiple pages of content. Each page has 20-30 Bootstrap accordions. When clicked the accordions expand to display additional information a

Solution 1:

Try the following

$(document).ready(function(){
  var posTop = $(location.hash + '.collapse').offset().top;
  $('html,body').animate({
      scrollTop: posTop - 20; //where 20 is allowance from top of the page
   });
});

Solution 2:

Bill-

Try using this snippet of jQuery-->

//$( document ).ready(function() {//location.hash && $(location.hash + '.collapse').collapse('show');//Move the window's scrollTop to the offset position of the div named #now
$(window).scrollTop($('#now').offset().top);

//});

Let me know if this works for you. Cheers!

Post a Comment for "Navigate To Bootstrap Accordion From Another Page"