Twitter Bootstrap - Tabs - URL doesn't change


(· ((Ivanka Todorova)

I'm using Twitter Bootstrap and its "tabs".

I have the following code:

<ul class="nav nav-tabs">
    <li class="active"><a data-toggle="tab" href="#add">add</a></li>
    <li><a data-toggle="tab" href="#edit" >edit</a></li>
    <li><a data-toggle="tab" href="#delete" >delete</a></li>
</ul>

The tags are working fine but not adding #add, #edit, #delete to the URL.

When I remove the data-toggleURL change, but the tab doesn't work.

Is there any solution?

Thomas Buck

Try this code. It adds the tag href to the url and opens the tag based on the hash on page load:

$(function(){
  var hash = window.location.hash;
  hash && $('ul.nav a[href="' + hash + '"]').tab('show');

  $('.nav-tabs a').click(function (e) {
    $(this).tab('show');
    var scrollmem = $('body').scrollTop() || $('html').scrollTop();
    window.location.hash = this.hash;
    $('html,body').scrollTop(scrollmem);
  });
});

Related


Twitter Bootstrap - Tabs - URL doesn't change

(· ((Ivanka Todorova) I'm using Twitter Bootstrap and its "tabs". I have the following code: <ul class="nav nav-tabs"> <li class="active"><a data-toggle="tab" href="#add">add</a></li> <li><a data-toggle="tab" href="#edit" >edit</a></li> <li><a data

Nested Tabs - Twitter Bootstrap

Abdelrahman Shoman So I'm trying to develop a web page with some nested tabs This means I have two tabs and when I press one of them I will be able to see both tabs. The first level of tabs works fine for me, but nested tabs don't. This means you have two tabs

Twitter Bootstrap dropdown with tabs

Tim Peterson I am trying to make a dropdown menu with tabs. The problem is that the dropdown closes when the tab is clicked. Watch this demo : http://jsfiddle.net/timrpeterson/pv2Lc/2/ . (Code reproduced below). In enumerating suggestions,stopPropagation() hav

Nested Tabs - Twitter Bootstrap

Abdelrahman Shoman So I'm trying to develop a web page with some nested tabs This means I have two tabs and when I press one of them I will be able to see both tabs. The first level of tabs works fine for me, but nested tabs don't. This means you have two tabs

Twitter Bootstrap modal doesn't work

Baig: I am new to Twitter Bootstrap. I am using the modal panel and it is not showing. It fades the screen, but the modal itself doesn't appear. I have checked the error console and there are no errors. My code is inside the <head>tag; I include the following

Twitter bootstrap modal background doesn't disappear

Paganotti I'm using Twitter to bootstrap a modal dialog. When I click the submit button of the bootstrap modal dialog it sends an AJAX request. My problem is that the modal background doesn't disappear. The "modal" dialog does disappear correctly, but leaves t

Twitter Bootstrap doesn't show gutter

Alexandru Garambu I'm using twitter bootstrap 3 to create a website template, and as far as I can tell, there are usually 15 px gutters on either side of a large monitor, but I don't have a gutter between the divs. <!DOCTYPE html> <html lang="en"> <head>

Twitter Bootstrap modal doesn't work

Baig: I am new to Twitter Bootstrap. I am using the modal panel and it is not showing. It fades the screen, but the modal itself doesn't appear. I have checked the error console and there are no errors. My code is inside the <head>tag; I include the following

Float doesn't work with Twitter-Bootstrap

mr santiago I'm looking for an answer, but every time I try to use the answer, I still don't get the desired result. I'm using bootstrap thumbnail elements and trying to make them float over each other like they do on a bootstrap website. Try stuffing them int

Twitter bootstrap modal background doesn't disappear

Paganotti I'm using Twitter to bootstrap a modal dialog. When I click the submit button of the bootstrap modal dialog it sends an AJAX request. My problem is that the modal background doesn't disappear. The "modal" dialog does disappear correctly, but leaves t

Twitter bootstrap modal doesn't work

Baig I am new to Twitter Bootstrap. I am using the modal panel and it is not showing. It fades the screen, but the modal itself doesn't appear. I checked the error console and there are no errors. My code is inside the <head>tag; I include the following script

JavaScript doesn't work with Twitter Bootstrap modal

Thomas Lin I'm trying to implement some javascript using twitter bootstrap's modal which works fine on jsFiddle but doesn't work on my site . HTML: <a href="#Modal1" class="link-glow" data-toggle="modal">link</a> <div class="modal fade" id="Modal1" tabindex="

Float doesn't work with Twitter-Bootstrap

mr santiago I'm looking for an answer, but every time I try to use the answer, I still don't get the desired result. I'm using bootstrap thumbnail elements and trying to make them float over each other like they do on a bootstrap website. Try stuffing them int

Twitter Bootstrap: Dropdown class doesn't work

John Sanderson I'm trying to see the results of the following sample code from Bootstrap's O'Reilly book. I've seen several other articles on this topic, but none seem to explain the small example below . Although I have included the bootstrap css and js files

Twitter Bootstrap doesn't show gutter

Alexandru Galamb I'm using twitter bootstrap 3 to create a website template and as far as I know there are usually 15 px gutters on both sides on large displays, but I don't have gutters between the divs. <!DOCTYPE html> <html lang="en"> <head> <meta c

Twitter Bootstrap modal doesn't work

Baig: I am new to Twitter Bootstrap. I am using the modal panel and it is not showing. It fades the screen, but the modal itself doesn't appear. I have checked the error console and there are no errors. My code is inside the <head>tag; I include the following

Twitter bootstrap modal background doesn't disappear

Paganotti I'm using Twitter to bootstrap a modal dialog. When I click the submit button of the bootstrap modal dialog it sends an AJAX request. My problem is that the modal background doesn't disappear. The "modal" dialog does disappear correctly, but leaves t

JavaScript doesn't work with Twitter Bootstrap modal

Thomas Lin I'm trying to implement some javascript using twitter bootstrap's modal which works fine on jsFiddle but doesn't work on my site . HTML: <a href="#Modal1" class="link-glow" data-toggle="modal">link</a> <div class="modal fade" id="Modal1" tabindex="

Twitter Bootstrap: Dropdown class doesn't work

John Sanderson I'm trying to see the results of the following sample code from Bootstrap's O'Reilly book. I've seen several other articles on this topic, but none seem to explain the small example below . Although I have included the bootstrap css and js files

Twitter Bootstrap doesn't show gutter

Alexandru Galamb I'm using twitter bootstrap 3 to create a website template and as far as I know there are usually 15 px gutters on both sides on large displays, but I don't have gutters between the divs. <!DOCTYPE html> <html lang="en"> <head> <meta c

jQuery Tabs: doesn't work (doesn't change the page)

Mattia Del Franco I'm trying to use jQuery Tab, but I can't get it to work. I have this HTML code: <!-- / NAVIGATORE / --> <div class="navigator windowtemplate movingwindow"> <div class="top">Navigatore <a href="#"><span class="closebutton closedialog"></spa

UIActivityViewController doesn't post URL to Twitter and Facebook

Vanessa I am using UIActivityViewController to share some text, URL and image to email, twitter, facebook etc. // Define parameters NSString *text = @"example text"; NSURL *url = [NSURL URLWithString:@"www.google.com"]; UIImage *image = self.myImage; // Creat

Twitter bootstrap tabs and javascript events

Javaaaa: I'm using Twitter Bootstrap for a project - specifically its tabs feature ( http://twitter.github.com/bootstrap/javascript.html#tabs ) Now I have this list of tabs and when I press the tab it switches to the content of each tab. However, this content

Twitter Bootstrap: Modal dialog tabs

VB_ What I want: Disable the ability to open -references ain a new browser tab/window . Possible solution: replace the -reference hrefattribute with .adata-href Problem: Due to twitter bootstrap, hrefattribute must be used to switch modal dialog tabs . data-hr

Twitter Bootstrap: Modal dialog tabs

VB_ What I want: Disable the ability to open -references ain a new browser tab/window . Possible solution: replace the -reference hrefattribute with .adata-href Problem: Due to twitter bootstrap, hrefattribute must be used to switch modal dialog tabs . data-hr

Twitter bootstrap tabs and javascript events

Javaaaa: I'm using Twitter Bootstrap for a project - specifically its tabs feature ( http://twitter.github.com/bootstrap/javascript.html#tabs ) Now I have this list of tabs and when I press the tab it switches to the content of each tab. However, this content

Twitter Bootstrap: Modal dialog tabs

VB_ What I want: Disable the ability to open -references ain a new browser tab/window . Possible solution: replace the -reference hrefattribute with .adata-href Problem: Due to twitter bootstrap, hrefattribute must be used to switch modal dialog tabs . data-hr