get rid of the anchor scrolling hacking way and do it the right way using css

Esse commit está contido em:
tim-kos
2014-02-21 10:50:07 +01:00
commit 5f9bbab1d4
2 arquivos alterados com 9 adições e 32 exclusões
+9
Ver Arquivo
@@ -347,3 +347,12 @@ ol.toc ol li:before {
.teaser {
text-align: center;
}
/* add extra space above headlines so that anchor scrolling
shows the heading and not the fixed header */
h1:before, h2:before, h3:before, h4:before {
display: block;
content: "";
height: 70px;
margin: -70px 0 0;
}
-32
Ver Arquivo
@@ -16,36 +16,4 @@ $(function() {
});
}
});
// fix onpage anchors
$('a').click(function(e) {
if ($(this).attr('href').indexOf('#') !== -1) {
e.preventDefault();
$('html, body').animate({
scrollTop: $($(this).attr('href')).offset().top - 70
}, 200);
var href = window.location.href;
var pos = href.indexOf('#');
if (pos === -1) {
window.location.href += $(this).attr('href');
} else {
window.location.href = href.substr(0, pos) + $(this).attr('href');
}
}
});
// scroll to the proper anchor if the browser location contains a hashbang
var href = window.location.href;
var pos = href.indexOf('#');
if (pos !== -1) {
var name = href.substr(pos + 1);
var $target = $('#' + name);
if ($target.length > 0) {
$('html, body').animate({
scrollTop: $target.offset().top - 70
}, 200);
}
}
});