Improve header anchor behavior

This commit is contained in:
Naoki Takezoe
2015-10-04 13:17:07 +09:00
parent bacf391a39
commit ed21ee8bdb
2 changed files with 10 additions and 17 deletions

View File

@@ -1681,13 +1681,15 @@ div.markdown-body table colgroup + tbody tr:first-child td:last-child {
}
.markdown-head {
left: -18px;
padding-left: 18px;
position: relative;
line-height: 1.7;
}
a.markdown-anchor-link {
position: absolute;
left: -18px;
left: 0px;
display: none;
color: #999;
/* From octicon style */

View File

@@ -23,18 +23,9 @@ $(function(){
$(e.target).children('a.markdown-anchor-link').show();
});
$('.markdown-head').mouseleave(function(e){
var anchorLink = $(e.target).children('a.markdown-anchor-link');
if(anchorLink.data('active') !== true){
anchorLink.hide();
}
$(e.target).children('a.markdown-anchor-link').hide();
});
$('a.markdown-anchor-link').mouseenter(function(e){
$(e.target).data('active', true);
});
$('a.markdown-anchor-link').mouseleave(function(e){
$(e.target).data('active', false);
$(e.target).hide();
});
@@ -360,12 +351,12 @@ function scrollIntoView(target){
}
}
/**
* escape html
*/
function escapeHtml(text){
return text.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/"/g,'&quot;').replace(/>/g,'&gt;');
}
///**
// * escape html
// */
//function escapeHtml(text){
// return text.replace(/&/g,'&amp;').replace(/</g,'&lt;').replace(/"/g,'&quot;').replace(/>/g,'&gt;');
//}
/**
* calculate string ranking for path.