Add href to heading anchors so that the url for the anchor is displayed in the url bar when clicking the header
This commit is contained in:
parent
bb0c878e06
commit
a7f329d337
|
@ -12,6 +12,14 @@ body {
|
|||
.hidden {
|
||||
display: none;
|
||||
}
|
||||
a h1,
|
||||
a h2,
|
||||
a h3,
|
||||
a h4,
|
||||
a h5 {
|
||||
color: #000;
|
||||
pointer: cursor;
|
||||
}
|
||||
h2,
|
||||
h3 {
|
||||
margin-top: 2.5em;
|
||||
|
|
|
@ -56,6 +56,8 @@ $( document ).ready(function() {
|
|||
content.find("h1, h2, h3, h4, h5").wrap(function(){
|
||||
var wrapper = $("<a class=\"header\">");
|
||||
wrapper.attr("name", $(this).text());
|
||||
// Add so that when you click the link actually shows up in the url bar...
|
||||
wrapper.attr("href", $(location).attr('href') + "#" + $(this).text());
|
||||
return wrapper;
|
||||
});
|
||||
|
||||
|
|
|
@ -15,6 +15,13 @@ html, body {
|
|||
display: none;
|
||||
}
|
||||
|
||||
a {
|
||||
h1, h2, h3, h4, h5 {
|
||||
color: black;
|
||||
pointer: cursor;
|
||||
}
|
||||
}
|
||||
|
||||
h2, h3 { margin-top: 2.5em }
|
||||
h4, h5 { margin-top: 2em }
|
||||
|
||||
|
|
Loading…
Reference in New Issue