Show More
@@ -140,8 +140,19 require([ | |||
|
140 | 140 | }); |
|
141 | 141 | |
|
142 | 142 | // set hash on tab click |
|
143 | $("#tabs").find("a").click(function() { | |
|
144 | window.location.hash = $(this).attr("href"); | |
|
143 | $("#tabs").find("a").click(function(e) { | |
|
144 | // Prevent the document from jumping when the active tab is changed to a | |
|
145 | // tab that has a lot of content. | |
|
146 | e.preventDefault(); | |
|
147 | ||
|
148 | // Set the hash without causing the page to jump. | |
|
149 | // http://stackoverflow.com/a/14690177/2824256 | |
|
150 | var hash = $(this).attr("href"); | |
|
151 | if(window.history.pushState) { | |
|
152 | window.history.pushState(null, null, hash); | |
|
153 | } else { | |
|
154 | window.location.hash = hash; | |
|
155 | } | |
|
145 | 156 | }); |
|
146 | 157 | |
|
147 | 158 | // load tab if url hash |
General Comments 0
You need to be logged in to leave comments.
Login now