0

I'm using bootstrap tabs on my page one of which contains comments, I've used a script to allow me to open the tab by adding #comments_tab to the URL which works fine but if i want to goto a specific comment within the tab is there a way to do it?

I can't seem to use two hash tags like #comments_tab#post-12345

If the tab is already open and i add #post-12345 it goes to the comment i just need a way to combine opening the tab and going to the comment.

This is the script for opening the tab

$(function(){
  var hash = window.location.hash;
  hash && $('ul.nav a[href="' + hash + '"]').tab('show');
});
Exoon
  • 1,513
  • 4
  • 20
  • 35
  • Why wouldn't you just use javascript to move the page down to the post hash location after opening the comments tab? No need to feed it to the browser URL: https://stackoverflow.com/questions/5284814/jquery-scroll-to-div – random_user_name Sep 01 '17 at 13:05
  • @cale_b yes that is what i'm looking for, I will have a read through see if i can figure out how to implement it, thanks. – Exoon Sep 01 '17 at 13:13
  • @cale_b i still think i have the same issue as i can't do both things open the tab and then scroll down to the hash location, I added the script from the link you sent but it only scrolls down to the comment when i manually open the tab. – Exoon Sep 01 '17 at 13:18

0 Answers0